[vtkusers] Problems with TIFF Writer while writing a volume
Amy Squillacote
amy.squillacote at kitware.com
Tue Jul 31 08:30:17 EDT 2007
Hi Enkelejda,
I'm not sure whether this is what's causing your problems, but
FileDimensionality for the vtkTIFFReader should be set to 2 if you're
reading a series of images. This is because each of the tiff images you
are reading contains a 2D slice of your 3D dataset, so the
dimensionality of the data in each file is 2D.
- Amy
Enkelejda Tafaj wrote:
> Hi,
>
> I'm using the vtkTIFFWriter to convert a 8-bit tiff image sequence into a volume. In my application I go through following steps:
>
> 1. Using the vtkTiffReader I first read a sequence of 50 8-bit tiff images. Thereby I'm setting the file dimensionality to 3.
>
> 2. In a second step I'm using a Gaussian filter to smooth the image stack.
>
> 3. At the end i would like to write out the filter result as a volume. If i use the TIFFWriter like below, it writes out a concatenation of the image sequence along the y axis. I don't get a volume but one very long image.
>
> What am I doing wrong?
>
> Thanks for your help!
>
> Enkelejda
>
>
>
> // 1. reading image sequence
> vtkTIFFReader *imageReader = vtkTIFFReader::New();
> imageReader->SetFilePrefix("image_");
> imageReader->SetFilePattern("%s%.d.tif");
> imageReader->SetFileDimensionality(3);
> imageReader->SetDataExtent(0,299,0,299,1,50);
> imageReader->SetDataSpacing(1,1,1);
> imageReader->SetDataByteOrderToLittleEndian();
> imageReader->UpdateWholeExtent();
>
> // 2. Some Filtering-...
> vtkImageMedian3D *filter = vtkImageMedian3D::New();
> filter->SetKernelSize(3,3,3);
> filter->SetInputConnection(imageReader->GetOutputPort());
> filter->UpdateWholeExtent();
>
> // 3. write out the result as a volume
> vtkTIFFWriter *volumeWriter = vtkTIFFWriter::New();
> volumeWriter->SetInputConnection(filter->GetOutputPort());
> volumeWriter->SetFileDimensionality(3);
> volumeWriter->SetFileName("test_volume.tif");
> volumeWriter->Write();
>
>
--
Amy Squillacote
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
Phone: (518) 371-3971 x106
More information about the vtkusers
mailing list