[vtkusers] ImageReader2 Issue

Doug Hoppes dhoppes at mbfbioscience.com
Fri May 14 09:21:55 EDT 2010


Hi All,

 

                I've just started playing with the VTK libraries and
seem to have run into a small issue about reading my tif file.  

 

                If I use the code to read my tif file:

----------------------------------

      vtkSmartPointer<vtkImageReader2> pReader =
vtkSmartPointer<vtkImageReader2>::New();

      pReader->SetFilePrefix("TestImages\\input");

      pReader->SetFilePattern("%s%03d.tif");

      pReader->SetDataScalarTypeToUnsignedChar();

      pReader->SetNumberOfScalarComponents(1);

      pReader->SetDataOrigin(0,0,0);

      pReader->SetDataSpacing(1,1,1);

      pReader->SetFileLowerLeft(0);

      pReader->SetDataExtent(0, 274, 0, 246, 0, 10);

---------------------  

      The image file is not correct.  It's kind of weird.  It looks like
the image is shifted to the right and a wrap-around is done (where the
right one-quarter side of the image is on the left.  

 

      If I use the code to read my tif file:

----------------------------------

      vtkSmartPointer<vtkImageAppend> pImageList =
vtkSmartPointer<vtkImageAppend>::New();

      pImageList->SetAppendAxis(2);

      for (int i=0; i<10; i++)

      {

            vtkSmartPointer<vtkTIFFReader> pReader =
vtkSmartPointer<vtkTIFFReader>::New();

            QString file = "TestImages\\GreenCells\\Images_2_0001_00" +
QString::number(i) + ".tif";

            pReader->SetFileName(file.toStdString().c_str());

            pImageList->AddInput(pReader->GetOutput());

      }

---------------------  

      The image looks beautiful and is correct.  

 

      Is there something that I'm missing on using the ImageReader2?  I
have a sample image file if anyone wants to look at it.

 

Dougie

 

 

 

---------------------------------------------------

Doug Hoppes doug at mbfbioscience.com

Senior Software Engineer

MBF Bioscience (Microbrightfield, Inc.)

+1.802.288.9290 ext:119

www.mbfbioscience.com

---------------------------------------------------

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100514/47b435fe/attachment.htm>


More information about the vtkusers mailing list