Difference between revisions of "Projects:SlicerFAQ:ImageOrientationFix"

From NAMIC Wiki
Jump to: navigation, search
Line 1: Line 1:
*[[Projects:SlicerFAQ back to Slicer FAQ]]
+
*[[Projects:SlicerFAQ|back to Slicer FAQ]]
  
 
= How do I fix an wrong orientation of a loaded image volume?  =  
 
= How do I fix an wrong orientation of a loaded image volume?  =  

Revision as of 16:42, 11 November 2010

Home < Projects:SlicerFAQ:ImageOrientationFix

How do I fix an wrong orientation of a loaded image volume?

  • My image appears upside down / facing the wrong way / I have incorrect/missing axis orientation
  • Slicer presents and interacts with images in 'physical space, which differs from the way the image is stored by a separate transform that defines how large the voxels are and how the image is oriented in space, e.g. which side is left or right. This information is stored in the image header, and different image file formats have different ways of storing this information. If Slicer supports the image format, it should read the information in the header and display the image correctly. If the image appears upside down or with distorted aspect ratio etc, then the image header information is either missing or incorrect.
  • You can correct the voxel dimensions and the image origin in the Info tab of the Volumes module, and you can reorient images via the Transforms module. Reorientation however will work only if the incorrect orientation involves rotation or translation. If axes are flipped (e.g. if left & right are flipped because the x-axis direction is defined incorrectly), then there is no tool in Slicer to alter that. This is by design; Slicer does not want to offer tools to (inadvertedly) manipulate image information that should be static and could lead to misrepresented image data.
  • However fixing incorrect orientations such as flipped axes is not that hard and can be done with the help of Slicer:
1. load the image into slicer (Load Volume, Add Data,Load Scene..)
2. save the image back out as NRRD (.nhdr) format.
3. open the .nhdr with a text editor of your choice. You should see a line that looks like this:
 space: left-posterior-superior
 sizes: 448 448 128
 space directions: (0.5,0,0) (0,0.5,0) (0,0,0.8)
4. the three brackets ( ) represent the coordinate axes as defined in the space line above, i.e. the first one is left-right, the second anterior-posterior, and the last inferior-superior. To flip an axis place a minus sign in front of the respective number, which is the voxel dimension. E.g. to flip left-right, change the line to
 space directions: (-0.5,0,0) (0,0.5,0) (0,0,0.8)
5. alternatively if the entire orientation is wrong, i.e. coronal slices appear in the axial view etc., you may easier just change the space field to the proper orientation. Note that Slicer uses RAS space by default, i.e. first (x) axis = left-right, second (y) axis = posterior-anterior, third (z) axis = inferior-superior
6. save & close the edited .nhdr file and reload the image in slicer to see if the orientation is now correct.