[vtkusers] Scalar type changing unexpectedly in
jmerkow
jmerkow at gmail.com
Fri Apr 18 12:53:39 EDT 2014
Hello,
I am working on a project that utilizes vtk extensively. For one of the
functions I need to change the origin and spacing, to do this I am using the
vtkChangeInformation class. My problem is that this filter is producing a
an image that has a different scalar type then the input. I have tried to
change it using SetScalarType but its not working. The input scalar type to
the filter is short, but its outputting double.
cvStrPts is basically a wrapper class for vtkstructuredpoints.
static void myclass::vtkSetInfo2Reference(vtkStructuredPoints* in)
{
if(Self::Debug)
std::cout << "vtkSetInfo2Reference: in " << in->GetScalarTypeAsString()
<<std::endl;
vtkStructuredPoints* temp = vtkStructuredPoints::New();
temp->SetScalarType(in->GetScalarType(),in->GetInformation());
temp->DeepCopy(in);
if(Self::Debug)
std::cout << "vtkSetInfo2Reference: temp " <<
temp->GetScalarTypeAsString() <<std::endl;
vtkSmartPointer<vtkImageChangeInformation> changer =
vtkSmartPointer<vtkImageChangeInformation>::New();
changer->SetInputData(temp);
changer->SetOutputOrigin(Self::Origin);
changer->SetOutputSpacing(Self::Spacing);
in->DeepCopy(changer->GetOutput());
in->SetScalarType(temp->GetScalarType(),temp->GetInformation());
if(Self::Debug)
std::cout << "vtkSetInfo2Reference: " << in->GetScalarTypeAsString()
<<std::endl;
temp->Delete();
}
using this function outputs:
vtkSetInfo2Reference: in short
vtkSetInfo2Reference: temp short
vtkSetInfo2Reference: double
SetFeatureImage s after reference: double
Any idea why the scalar type is being changed by the ChangeInformation
filter? and why Its not being set back? I assume I can solve this with a
vtkImageCast filter, but I don't understand why changeInformation would
modify the scalar type.
Jameson
--
View this message in context: http://vtk.1045678.n5.nabble.com/Scalar-type-changing-unexpectedly-in-tp5726862.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list