Mismatch between the image origin stored in vtk-files and the one displayed by Slicer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Mismatch between the image origin stored in vtk-files and the one displayed by Slicer

Christian Bauer-3
Hi!
       
        I'm using Slicer 3.6 and found that there is a mismatch between
        the
        image origin stored in vtk-files and the one displayed by
        slicer.
       
        When I use the itk code below to create a vtk-file where I set
        the
        origin to 10/20/30 and I read the file with Slicer (Add
        volume...) the image origin is displayed as -10/-20/30.
        I also tried to store the image as .nii, .nrrd, and .hdr files,
        always with the same result.
       
        Using ParaView for reading the files, the origin is the one I
        expect.
       
        I guess this behavior is related to some image orientation
        issues I
        don't understand. I hope, someone can explain this behavior to
        me.
       
        Thanks,
        Christian
       
        #include <itkImage.h>
        #include <itkImageFileWriter.h>
       
        int main(int argc, char**argv)
        {
            typedef itk::Image<short, 3> ImageType;
            typedef itk::ImageFileWriter< ImageType > ImageWriterType;
           
            ImageType::Pointer image = ImageType::New();
            ImageType::RegionType region;
            region.SetSize(0, 10);
            region.SetSize(1, 10);
            region.SetSize(2, 10);
            image->SetRegions( region );
            ImageType::PointType origin;
            origin[0]=10;
            origin[1]=20;
            origin[2]=30;
            image->SetOrigin( origin );
            image->Allocate();
                   
            ImageWriterType::Pointer imageWriter =
        ImageWriterType::New();
            imageWriter->SetFileName( "test.vtk" );
            imageWriter->SetInput( image );
            imageWriter->Update();
        }
       
       

_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: Mismatch between the image origin stored in vtk-files and the one displayed by Slicer

pieper
Administrator
Hi Christian -

The difference is that slicer uses RAS internally, while ITK uses LPS.
(If that's not clear, the following links should help clarify...) ;)

Best,
Steve

http://www.slicer.org/slicerWiki/index.php/Coordinate_systems

http://www.na-mic.org/Wiki/index.php/Coordinate_System_Conversion_Between_ITK_and_Slicer3

On Jul/26/10 1:30 PM, Christian Bauer wrote:

> Hi!
>
>          I'm using Slicer 3.6 and found that there is a mismatch between
>          the
>          image origin stored in vtk-files and the one displayed by
>          slicer.
>
>          When I use the itk code below to create a vtk-file where I set
>          the
>          origin to 10/20/30 and I read the file with Slicer (Add
>          volume...) the image origin is displayed as -10/-20/30.
>          I also tried to store the image as .nii, .nrrd, and .hdr files,
>          always with the same result.
>
>          Using ParaView for reading the files, the origin is the one I
>          expect.
>
>          I guess this behavior is related to some image orientation
>          issues I
>          don't understand. I hope, someone can explain this behavior to
>          me.
>
>          Thanks,
>          Christian
>
>          #include<itkImage.h>
>          #include<itkImageFileWriter.h>
>
>          int main(int argc, char**argv)
>          {
>              typedef itk::Image<short, 3>  ImageType;
>              typedef itk::ImageFileWriter<  ImageType>  ImageWriterType;
>
>              ImageType::Pointer image = ImageType::New();
>              ImageType::RegionType region;
>              region.SetSize(0, 10);
>              region.SetSize(1, 10);
>              region.SetSize(2, 10);
>              image->SetRegions( region );
>              ImageType::PointType origin;
>              origin[0]=10;
>              origin[1]=20;
>              origin[2]=30;
>              image->SetOrigin( origin );
>              image->Allocate();
>
>              ImageWriterType::Pointer imageWriter =
>          ImageWriterType::New();
>              imageWriter->SetFileName( "test.vtk" );
>              imageWriter->SetInput( image );
>              imageWriter->Update();
>          }
>
>
>
> _______________________________________________
> slicer-users mailing list
> [hidden email]
> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
> To unsubscribe: send email to [hidden email] with unsubscribe as the subject
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject