[vtkusers] Problem reading TIFF images
varshini varshini
vvarshini at hotmail.com
Tue Jul 5 11:46:10 EDT 2005
I am tryting to read a set of TIFF images and create a 3D volume from it.
The code below reads certain sets of images and not others. But I am able to
view all the images in Photoshop. So, Is there something wrong in my code or
can vtk read only certain TIFF files?
Thanks in advance,
CODE:
vtkTIFFReader *Reader = vtkTIFFReader::New();
Reader->SetFileDimensionality(3);
Reader->SetFilePrefix ("z1-"); //Location of slices
Reader->SetFilePattern("%s%.3d.tif");
Reader->SetDataExtent (0,511,0,511,101,120); //No.of slices
Reader->SetDataSpacing(1,1,1);
Reader->SetDataByteOrderToLittleEndian();
Reader->Update();
vtkColorTransferFunction *colorTransferFunction =
vtkColorTransferFunction::New();
colorTransferFunction->AddRGBPoint(0.0, 0.0, 0.0, 0.0);
colorTransferFunction->AddRGBPoint(255.0, 1.0, 1.0, 1.0);
vtkPiecewiseFunction *oTFun =vtkPiecewiseFunction::New();
oTFun->AddSegment(80,0.0,255,1.0);
vtkVolumeRayCastCompositeFunction *compositeFunction=
vtkVolumeRayCastCompositeFunction::New();
vtkVolumeRayCastMapper *volMapper = vtkVolumeRayCastMapper::New();
volMapper->SetInput(Reader->GetOutput());
volMapper->SetVolumeRayCastFunction(compositeFunction);
vtkVolumeProperty *volProperty = vtkVolumeProperty::New();
volProperty->SetColor(colorTransferFunction);
volProperty->SetScalarOpacity(oTFun);
volProperty->SetInterpolationTypeToLinear();
volProperty->SetInterpolationTypeToNearest();
vtkVolume *vol=vtkVolume::New();
vol->SetMapper(volMapper);
vol->SetProperty(volProperty);
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
More information about the vtkusers
mailing list