View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002173 | Slicer4 | Core: Base Code | public | 2012-06-06 13:22 | 2013-11-20 09:52 |
Reporter | lassoan | Assigned To | pieper | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | not fixable | ||
Product Version | Slicer 4.1.0 | ||||
Target Version | Slicer 4.3.0 | Fixed in Version | Slicer 4.3.0 | ||
Summary | 0002173: Image orientation is ignored when reading metaimage files | ||||
Description | Problem 1: Image orientation is ignored when reading metaimage (MHA) files: they are always assumed to be LPS. Problem 2: Image orientation is very probably written incorrectly when saving metaimage (MHA) files: the file contains "AnatomicalOrientation = RAI", while it should be "AnatomicalOrientation = LPS". | ||||
Additional Information | How to reproduce:
| ||||
Tags | No tags attached. | ||||
I'm not convinced that changing the 'AnatomicalOrientation' of an MHA file has the same meaning as changing the 'space' of a nrrd file. For a nrrd file, the meaning of things like 'space directions' is always referenced to the space tag: http://teem.sourceforge.net/nrrd/format.html#space But as nearly as I can tell the itkMetaImageIO.cxx uses the TransformMatrix field to set the Direction cosines and this is what defines the mapping from IJK to RAS for slicer (and I think in general all programs that rely on ITK's IndexToPhysical infrastructure would also ignore the AnatomicalOrientation flag in favor of the TransformMatrix). I'm going to mark this as will not fix -- if there is a use case for changing the MHA header in this way then feel free to re-open the bug and add info on the scenario. |
|
'AnatomicalOrientation' of an MHA file has the same meaning as changing the 'space' of a nrrd file. See http://www.itk.org/Wiki/ITK/MetaIO/Documentation: AnatomicalOrientation |
|
Yes, I agree that is what the documentation implies - I don't see anywhere in the ITK code where that is taken into account. Are you certain that other uses of the metaIO format interpret this field? If you look at the reader code it ignores this field (although it is probably passed as a typeless string in the metadata dictionary) https://github.com/Kitware/ITK/blob/master/Modules/IO/Meta/src/itkMetaImageIO.cxx#L79 |
|
The problem is that it is not taken into account. I don't know where the axis orienting is done for other file formats, such as NRRD, but it should be probably implemented similarly for meta. The orienting to LPS could be (should have been) implemented in ITK and in Slicer we would further orient the axes to RAS; or all the orienting could be done in one step in Slicer. As the reorienting is not implemented in ITK I assume that all the applications that rely on ITK ignore this field. Probably we should consult ITK / MetaIO people to hear their opinion. |
|
I agree that this an issue for the ITK/MetaIO community should be able to help us with. As far as I know slicer treats all formats identically in the sense that it delegates to ITK the process or reading pixels, spacing, orientation, and directions. From there slicer creates a uniform representation in the mrml volume node. I don't see that there's anything fixable on the slicer side - we might consider generating a geometry warning when trying to read meta files if we think there's a realistic possibility that people will run into this issue in practice. Yes, I would guess that all applications that use ITK to read meta files would behave the same way slicer does unless they probe the metadata dictionary explicitly. I would also guess that most applications do not do that. And I would guess that most applications that use meta use it via ITK. Therefore I don't see this as a bug we can deal with inside slicer's code, but something we can pass over to the ITK community. |
|
MetaIO works using direction cosines to represent how data is stored. The anatomic information is not mathematically interpreted - they are meant to help applications interpret how the data should be labeled when displayed. If you change it, the direction cosines are not recomputed. For example, when an application inverts direction cosines, the application is responsible for updating the anatomic labels. MetaIO is a file format - it writes out what you tell it and it reports what it reads. |
|
ITK usually converts the image axes orientation to LPS. So, after the medical image is loaded into ITK, in the resulting image the +x direction always corresponds to L direction, etc. It is achieved by reordering/inverting the components of the direction cosines matrix, according to the patient orientation. For NRRD file format the reordering/inverting is implemented in ITKv3\Code\IO\itkNrrdImageIO.cxx. For MetaIO the orientation ignored (just stored), but not used to compute the correct direction cosines, see ITKv3\Code\IO\itkMetaImageIO.cxx. To be consistent, ITK should either always ignore the orientation (and let the application level code to perform this), or always perform the orientation normalization (preferred option; this way all applications would be simpler). |
|
Since this is an issue in ITK itself, there is nothing we can do in slicer to fix it. A topic should be opened on the ITK tracker pointing to this issue for background. |
|
Did this ever make it to upstream? |
|
I've looked at the MetaIO documentation and it contains a clarification of the anatomical orientation: http://www.itk.org/Wiki/Proposals:Orientation#Some_notes_on_the_DICOM_convention_and_current_ITK_usage In summary, RAI in a MetaIO image means DICOM LPS. Therefore the header information in saved files are correct. ITK ignores anatomical orientation information and just always assumes DICOM LPS. As the assumption is true for files are saved by ITK or Slicer, I would consider treating anatomical orientation management in MetaIO in ITK and enhancement request. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2012-06-06 13:22 | lassoan | New Issue | |
2012-06-07 22:50 | finetjul | Relationship added | related to 0002102 |
2012-06-07 22:50 | finetjul | Status | new => assigned |
2012-06-07 22:50 | finetjul | Assigned To | => pieper |
2012-08-22 04:05 | pieper | Target Version | => Slicer 4.2.0 - Feature freeze Sept 1st 2012 |
2012-08-22 11:30 | pieper | Note Added: 0005718 | |
2012-08-22 11:30 | pieper | Status | assigned => closed |
2012-08-22 11:30 | pieper | Resolution | open => won't fix |
2012-08-22 11:39 | lassoan | Note Added: 0005721 | |
2012-08-22 11:39 | lassoan | Status | closed => feedback |
2012-08-22 11:39 | lassoan | Resolution | won't fix => reopened |
2012-08-22 11:51 | pieper | Note Added: 0005723 | |
2012-08-22 14:34 | lassoan | Note Added: 0005745 | |
2012-08-22 14:50 | pieper | Note Added: 0005747 | |
2012-08-23 04:51 | pieper | Status | feedback => acknowledged |
2012-08-23 04:51 | pieper | Target Version | Slicer 4.2.0 - Feature freeze Sept 1st 2012 => Slicer 4.3.0 |
2012-08-27 07:49 | aylward | Note Added: 0005796 | |
2012-08-27 08:29 | lassoan | Note Added: 0005797 | |
2012-09-20 10:59 | pieper | Note Added: 0006146 | |
2012-09-20 10:59 | pieper | Status | acknowledged => closed |
2012-09-20 10:59 | pieper | Resolution | reopened => not fixable |
2013-02-12 09:41 | jcfr | Fixed in Version | => Slicer 4.3.0 |
2013-11-20 07:50 | inorton | Note Added: 0010354 | |
2013-11-20 09:52 | lassoan | Note Added: 0010355 |