[vtkusers] How to get original image data values from vtkTIFFReader without scaling?

varshini v vvarshini at hotmail.com
Mon Jul 11 10:56:10 EDT 2005


I am trying to read a series of TIFF images using vtkTIFFReader and get the 
data from it , and use it. I am able to read the image and get the data, but 
it seems to have been scaled. There is no ScalingOff() option in it. Does 
anyone know how to get the original data, without any scaling? Below is the 
code that I am using now to get the array of data.


vtkTIFFReader *Reader = vtkTIFFReader::New();

	Reader->SetFileDimensionality(3);
	Reader->SetFilePrefix ("a1-"); //Location of slices
	Reader->SetFilePattern("%s%.2d.tif");
	Reader->SetDataExtent (0,511,0,511,1,56); //No.of slices
	Reader->SetDataScalarTypeToFloat ();
	Reader->SetDataByteOrderToLittleEndian();
	Reader->Update();

vtkFloatArray *scalars2 =vtkFloatArray::New();
	scalars2=(vtkFloatArray 
*)(Reader->GetOutput()->GetPointData()->GetScalars());

	  for (i=0;i<(512*512*56);i++)
	  {
		   image[i] = (float)scalars2->GetValue(i);
	  }


Thanks in advance,

Varshini

_________________________________________________________________
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