[Paraview] Paraview or ITK bug: Y axis appears flipped in Paraview?

Andriy Fedorov fedorov at bwh.harvard.edu
Fri Apr 22 12:16:17 EDT 2005


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 ParaView mailing list