dzenanz
(Dženan Zukić)
January 31, 2018, 10:03pm
1
Slicer used to write .h5
or .tfm
files when a transform needed to be passed to a CLI:
<transform type="linear" fileExtensions=".tfm,.h5,.hdf5,.mat,.txt">
<longflag>transform0</longflag>
<description>...</description>
<label>rigid transform 0</label>
<channel>input</channel>
</transform>
but now a CLI gets --transform0 C:/Temp/Slicer/BDBAI_AAAAAAAABFECHIFA.mrml#vtkMRMLLinearTransformNode1
which itk::TransformFileReader cannot read. How to force Slicer to write an ITK-readable transform?
lassoan
(Andras Lasso)
January 31, 2018, 10:50pm
2
Which Slicer version does this? Many CLI modules uses transforms with ITK readers - do they work correctly?
dzenanz
(Dženan Zukić)
January 31, 2018, 10:52pm
3
1aa2f026195e7f8206748867cca4a6fc46197f7c from 2018-01-27
ihnorton
(Isaiah Norton)
February 1, 2018, 2:01am
4
Are you using the “force executable” setting in Settings->Modules?
lassoan
(Andras Lasso)
February 1, 2018, 3:56am
5
@dzenanz Many CLI modules uses transforms with ITK readers - do they work correctly?
For example, “Resample Scalar/Vector/DWI volume” module works correctly for me, writing the transform to .h5 file.
Full command line
Resample Scalar/Vector/DWI Volume command line:
C:/D/S4R/Slicer-build/lib/Slicer-4.9/cli-modules/Release/ResampleScalarVectorDWIVolume.exe --Reference C:/Users/msliv/AppData/Local/Temp/Slicer/CCCEE_vtkMRMLScalarVolumeNodeB.nrrd --transformationFile C:/Users/msliv/AppData/Local/Temp/Slicer/CCCEE_vtkMRMLLinearTransformNodeE.h5 --hfieldtype h-Field --interpolation linear --transform_order output-to-input --image_center input --spacing 0,0,0 --size 0,0,0 --direction_matrix 0,0,0,0,0,0,0,0,0 --number_of_thread 0 --default_pixel_value 0 --window_function c --spline_order 3 --transform_matrix 1,0,0,0,1,0,0,0,1,0,0,0 --transform a C:/Users/msliv/AppData/Local/Temp/Slicer/CCCEE_vtkMRMLScalarVolumeNodeB.nrrd C:/Users/msliv/AppData/Local/Temp/Slicer/CCCEE_vtkMRMLScalarVolumeNodeD.nrrd
It uses this XML:
<transform fileExtensions=".h5">
<name>transformationFile</name>
<label>Transform Node</label>
<flag>-f</flag>
<longflag>--transformationFile</longflag>
<default/>
<channel>input</channel>
</transform>
You can add the few missing tags to your XML file (name, default, flag) and see if it makes a difference.
1 Like
dzenanz
(Dženan Zukić)
February 1, 2018, 4:17pm
6
After changing the fileExtensions=".tfm,.h5,.hdf5,.mat,.txt"
into fileExtensions=".tfm"
and recompiling the problem went away. Then I changed back into the original, and the transforms are still being written normally (as .tfm
files). Perhaps changes to CMake code made the difference. I explicitly added this (trying to fix an unrelated linking error with tests):
find_package(SlicerExecutionModel REQUIRED)
include(${SlicerExecutionModel_USE_FILE})
set(MABMIS_ITK_COMPONENTS
ITKIOImageBase
ITKTransform
ITKIOTransformBase
ITKIOXML
)
find_package(ITK 4.6 COMPONENTS ${MABMIS_ITK_COMPONENTS} REQUIRED)
set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt
include(${ITK_USE_FILE})
find_package(Slicer)
include(${Slicer_USE_FILE})
But why would any of this make a difference?
@ihnorton Disabling “Prefer executable CLIs” passes the images via pointer, but does not seem to affect transforms.
fedorov
(Andrey Fedorov)
February 2, 2018, 1:00pm
7
Are you running CLI a executable or shared library?
fedorov
(Andrey Fedorov)
February 2, 2018, 1:04pm
8
Sorry for the noise, I was on the phone and didn’t see the full thread.
lassoan
(Andras Lasso)
February 2, 2018, 1:57pm
9
I think you need to force recompilation after you change the module description XML. I noticed in the past that XML file changes did not take effect with a simple build.