[vtkusers] image scalar range problem
liulewes
lewes_infor at hotmail.com
Fri Dec 14 11:48:04 EST 2012
I'm tring to create an image and assign scalars manually. I think I should get a scalar range of [1,1] for the following code, but I get [1,52680] instead. Is it the problem of the assignment part or the GetScalarRange function or anything else?
vtkImageData* temp = vtkImageData::New();
temp->SetScalarTypeToUnsignedShort();
temp->SetSpacing(1,1,0);
temp->SetOrigin(0,0,0);
temp->SetExtent(0,511,0,511,0,1);
temp->SetNumberOfScalarComponents(1);
temp->AllocateScalars();
for (int i = 0 ; i < 512 ; ++i)
{
for (int j = 0 ; j < 512 ; ++j)
{
*(static_cast<unsigned short*>(temp->GetScalarPointer(i,j,0))) = 1;
}
}
temp->Modified();
temp->GetPointData()->GetScalars()->Modified();
double dtrangetemp[2];
temp->GetScalarRange(dtrangetemp);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121214/943dc47e/attachment.htm>
More information about the vtkusers
mailing list