[vtkusers] vtkImageChangeInformation changes ScalarType?

Michael Knopke Michael.Knopke at gmx.de
Tue Feb 27 09:16:21 EST 2007


Hi,

I just noticed that using vtkImageChangeInformation in my pipeline always
changes the ScalarType to double, before the type was unsigned_short

even when calling vtkImageCast->SetOutputScalarTypeToUnsignedShort();

the scalartype is still double. Very Strange.

Code:

v16 = vtkVolume16Reader::New();

v16...extend and spacing

v16->GetOutput()->GetScalarTypeAsString(); // returns unsigned_short

image_Change = vtkImageChangeInformation::New();
image_Change->CenterImageOn();

image_Change->GetOutput()->GetScalarTypeAsString(); // returns double

image_Cast = vtkImageCast::New();
image_Cast->SetOutputScalarTypeToUnsignedShort();

image_Cast->GetOutput()->GetScalarTypeAsString(); //returns double???

The reason I use GetOutput() and not as proposed for new standard GetOutputPort() is that some classes (like vtkImagePlaneWidget) don't support setting a port but use direct access to imageData ( via ->SetInput())

So using vtkImageChangeInformation with vtkImagePlaneWidget as input will give a wrong reslice (white output) because the datatype changed. Using v16 directly works.

Regards

Michael



-- 
"Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
Jetzt GMX ProMail testen: www.gmx.net/de/go/mailfooter/promail-out



More information about the vtkusers mailing list