<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:΢ÈíÑźÚ
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>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?<br><br> vtkImageData* temp = vtkImageData::New();<br> temp->SetScalarTypeToUnsignedShort();<br> temp->SetSpacing(1,1,0);<br> temp->SetOrigin(0,0,0);<br> temp->SetExtent(0,511,0,511,0,1);<br> temp->SetNumberOfScalarComponents(1);<br> temp->AllocateScalars();<br><br> for (int i = 0 ; i < 512 ; ++i)<br> {<br> for (int j = 0 ; j < 512 ; ++j)<br> {<br> *(static_cast<unsigned short*>(temp->GetScalarPointer(i,j,0))) = 1;<br> }<br> }<br><br> temp->Modified();<br> temp->GetPointData()->GetScalars()->Modified();<br> double dtrangetemp[2];<br> temp->GetScalarRange(dtrangetemp);<br>                                            </div></body>
</html>