[Insight-users] Re: Paraview or ITK bug: Y axis appears flipped in Paraview? (Andriy Fedorov)

BATY Xavier xavier.baty at univ-angers.fr
Mon Apr 25 10:25:46 EDT 2005


Hi all!

I saw a strange thing in Paraview too!

When I open an image, this one is well oriented. But the Y axis seems to go
from "low" to "high" of the screen(according to the refernce axis in the
left bottom of the image screen).

When I open a deformation field obtaining form ITK, I need to flip the Y
axis (turning the Y and Z axis around the X one to make the Y goes from
"high" to "low" of the screen) to see the deformation field correctly.

Is it normal??, have I made something wrong? Any idea??........

Thanks!
Xav

> Date: 22 Apr 2005 12:16:17 -0400
> From: "Andriy Fedorov" <fedorov at bwh.harvard.edu>
> Subject: [Insight-users] Paraview or ITK bug: Y axis appears flipped
> in Paraview?
> To: paraview at paraview.org, insight-users at itk.org
> Message-ID: <42692351.9050000 at bwh.harvard.edu>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi
>
> Please correct me if I am wrong. I am using the source code below to
> create a test image, which has pixels in the region cornered at
> (20,20,20) to (50,50,50) set to 1, and all other pixels set to 0. I
> display this in Paraview, threshold it to 1, and when I look at the
> resulting cube with cube axes visualized, the Y range shows as (100 -
> 130) or something; i.e., looks like the Y axis is flipped during
> visualization. Is this a bug, or am I missing something? Or is it ITK
> bug? I am using lates stable release of Paraview, 2.0.1, and ITK  2.0.0
> (both Linux). Thank you.
>
> Fedorov
>
>
>
> #include "itkImageFileWriter.h"
> #include "itkImage.h"
> #include "itkImageRegionIterator.h"
> #include "itkAddImageFilter.h"
>
> int main(int argc, char **argv)
> {
>    typedef unsigned int PixelType;
>    typedef itk::Image<PixelType,3> ImageType;
>
>    ImageType::Pointer cube1 = ImageType::New();
>    ImageType::RegionType bufferedRegion;
>    ImageType::RegionType largestRegion;
>
>    ImageType::SizeType size;
>    size[0] = 100;
>    size[1] = 150;
>    size[2] = 120;
>
>    ImageType::IndexType index = {0,0,0};
>    largestRegion.SetSize(size);
>    largestRegion.SetIndex(index);
>
>    cube1->SetRegions(largestRegion);
>    cube1->Allocate();
>    cube1->FillBuffer(0);
>
>    typedef itk::ImageRegionIterator<ImageType> IteratorType;
>    IteratorType it(cube1,largestRegion);
>    it.GoToBegin();
>    while(!it.IsAtEnd()){
>      ImageType::IndexType id = it.GetIndex();
>      if((id[0]>20 && id[0]<50) &&
>         (id[1]>20 && id[1]<50) &&
>         (id[2]>20 && id[2]<50))
>        it.Set(1);
>      ++it;
>    }
>
>    itk::ImageFileWriter<ImageType>::Pointer writer;
>    writer = itk::ImageFileWriter<ImageType>::New();
>    writer->SetInput( cube1 );
>    writer->SetFileName("cube20-50.mha");
>    writer->Update();
>
>    return 0;
> }



More information about the Insight-users mailing list