[vtkusers] Bugs in vtkImageData and vtkTiffWriter

Andinet Enquobahrie andinet.enqu at kitware.com
Mon Apr 7 17:08:27 EDT 2008


Hello Enkelejda,

We recently updated the tiff library version to libtiff 3.8.2 in 
VTK-CVS. Concurrently, we
updated the TIFF image reader (vtkTIFFReader).

The flipped image that you are observing is probably due to the use of 
the orientation tag
in your input image data. The new reader parses and uses orientation tag 
if available in the image
data. The old reader always ignores orientation tag and forces 
ORIENATION_BOTLEFT
( row 0 bottom, col 0 lhs ) type. For convenience,  we have added a 
SetOrientationType
method that you could invoke to force any orientation you are interested.

/* Set orientation type 
  ORIENTATION_TOPLEFT         1       (row 0 top, col 0 lhs)
  ORIENTATION_TOPRIGHT        2       (row 0 top, col 0 rhs)
  ORIENTATION_BOTRIGHT        3       (row 0 bottom, col 0 rhs)
  ORIENTATION_BOTLEFT         4       (row 0 bottom, col 0 lhs)
  ORIENTATION_LEFTTOP         5       (row 0 lhs, col 0 top)
  ORIENTATION_RIGHTTOP        6       (row 0 rhs, col 0 top)
  ORIENTATION_RIGHTBOT        7       (row 0 rhs, col 0 bottom)
  ORIENTATION_LEFTBOT         8       (row 0 lhs, col 0 bottom) */ 
  void SetOrientationType( unsigned int orientationType );
  vtkGetMacro( OrientationType, unsigned int );


For instance, the "beach.tif" image that is used in several of the tests 
in VTK
contains ORIENTATION_TOPLEFT tag. However, the old reader ignores this
tags and all the baseline images where generated with ORIENATION_BOTLEFT
orientation. Hence, to make sure all the regression tests pass after 
updating the reader
and the tiff library ( without changing the baseline images), we have 
added SetOrientationType
method invocation in all the tests that use this image file.

You can do the same thing in your example to orient the image to your need.

-Andinet


> Hi,
>
> last week I updated to the CVS VTK.
>
> Today I noticed that the class vtkImageData (or some other filtering 
> base class) is buggy. When trying to filter tif-images data with the 
> vtkSimpleImageFilterExample (SimpleImageFilterExample creates a copy 
> of the input data) the result is wrong. The output images are flipped.
>
> Any idea what is wrong?
>
>
> Btw: the vtkTiffWriter.* still doesn't allow to write tif images. I 
> used the patch proposed some times ago (see below, but the best would 
> be to update the CVS files
>
> RCS file: /cvsroot/VTK/VTK/IO/vtkTIFFWriter.cxx,v
> retrieving revision 1.41
> diff -r1.41 vtkTIFFWriter.cxx
> 124c124,125
> <   TIFF* tif = TIFFClientOpen(this->GetFileName(), "w",
> ---
> >   //  TIFF* tif = TIFFClientOpen(this->GetFileName(), "w",
> >   TIFF* tif = TIFFClientOpen(this->InternalFileName, "w",
>
>
>
> Thank you for you help.
> Enkelejda
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: 
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>


-- 
==========================================================
Andinet A. Enquobahrie, PhD
R&D Engineer
Kitware Inc.

28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x124
www.kitware.com





More information about the vtkusers mailing list