InsightSoftwareConsortium / ITKElastix

An ITK Python interface to elastix, a toolbox for rigid and nonrigid registration of images
Apache License 2.0
198 stars 22 forks source link

Feature: Write log to file without writing transform parameters #162

Open Svdvoort opened 2 years ago

Svdvoort commented 2 years ago

Currently, in order to write the log to file you need to do the following:

elastix_object = itk.ElastixRegistrationMethod[itk.Image[itk.F, 3], itk.Image[itk.F, 3]].New()
elastix_object.SetLogToFile(True)
elastix_object.SetLogFileName("out.log")
elastix_object.SetOutputDirectory("/data/")

However, by using elastix_object.SetOutputDirectory, the transform parameter file will also automatically be written to the specified output directory. I am already saving the transform parameter file separately (after manipulating it a bit ), so having it written to file without explicitly asking Elastix is confusing and clutters up folders.

Ideally, something like this would be sufficient, as it would be clear then that only the log file is written:

elastix_object = itk.ElastixRegistrationMethod[itk.Image[itk.F, 3], itk.Image[itk.F, 3]].New()
elastix_object.SetLogToFile(True)
elastix_object.SetLogFileName("/data/out.log")

However, explicitly setting that the transform parameter file should not be written is also a solution:

elastix_object = itk.ElastixRegistrationMethod[itk.Image[itk.F, 3], itk.Image[itk.F, 3]].New()
elastix_object.SetLogToFile(True)
elastix_object.SetLogFileName("out.log")
elastix_object.SetOutputDirectory("/data/")
elastix_object.SetWriteTransformParameters(False)
thewtex commented 2 years ago

CC @N-Dekker

thewtex commented 1 year ago

@N-Dekker has our logging options improved with 0.16.0, or will the spdlog related support be finalized in a future release?

N-Dekker commented 1 year ago

@thewtex Sorry, ITKElastix 0.16.0 based on elastix library release 5.1.0 does not yet have extra logging options. To be added in a future release!