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

Luis Ibanez luis.ibanez at kitware.com
Wed Apr 27 11:56:42 EDT 2005



Hi Xav,

Yes,
this is normal..., it is not good,.... but it is normal.

It is the cultural collision between the ComputerGraphics
community and the Image Processing community.

The standard interpretation of the Y axis direction is
different in VTK and ITK.  When you open files in VTK
they will appear flipped with respect to what you expect
from ITK.

Since ParaView uses VTK readers, then you see such flipping
when loading ITK images into ParaView.

You could deal with this in many ways:

1) using the ITK flip image filter before saving your images
    for visualization with ParaView

2) using the VTK flip filter when reading them.


Probably (1) is the easy way to go... just make sure that
you point this out in the filenames so you don't try to
load those flipped images back into ITK programs.



     BE VERY VERY AFFRAID OF THE FLIP IMAGE FILTER !!!


98,000 people die every year in the US alone as a consequence
of medical errors.


2% of the reported medical errors are related to left-right
confusions, and those are the ones that can result from
flipping an image...



Regards,


     Luis


---------------------
BATY Xavier wrote:

> 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;
>>}
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 





More information about the Insight-users mailing list