Description
The docstring for reverse_indexing in ITKReader is wrong.
reverse_indexing: whether to use a reversed spatial indexing convention for the returned data array.
If ``False``, the spatial indexing follows the numpy convention;
otherwise, the spatial indexing convention is reversed to be compatible with ITK. Default is ``False``.
This option does not affect the metadata.
np_img = itk .array_view_from_image (img , keep_axes = False )
if img .GetNumberOfComponentsPerPixel () == 1 : # handling spatial images
return np_img if self .reverse_indexing else np_img .T
# handling multi-channel images
return np_img if self .reverse_indexing else np .moveaxis (np_img .T , 0 , - 1 )
https://github.com/InsightSoftwareConsortium/ITK/blob/f5aab1f68e53061264f4f6f3af5e0d49c5f7481d/Wrapping/Generators/Python/itk/support/extras.py#L351-L354
In NrrdReader, even the header have been updated after _convert_f_to_c_order, it dosen't pass to the _get_affine, so the affine is still not updated.
if self .index_order == "C" :
header = self ._convert_f_to_c_order (header )
header [MetaKeys .ORIGINAL_AFFINE ] = self ._get_affine (i )
Reactions are currently unavailable
You can’t perform that action at this time.
The docstring for
reverse_indexinginITKReaderis wrong.MONAI/monai/data/image_reader.py
Lines 170 to 173 in abe2e31
MONAI/monai/data/image_reader.py
Lines 368 to 372 in abe2e31
https://github.com/InsightSoftwareConsortium/ITK/blob/f5aab1f68e53061264f4f6f3af5e0d49c5f7481d/Wrapping/Generators/Python/itk/support/extras.py#L351-L354
In
NrrdReader, even the header have been updated after_convert_f_to_c_order, it dosen't pass to the_get_affine, so the affine is still not updated.MONAI/monai/data/image_reader.py
Lines 1324 to 1326 in abe2e31