<DIV>hi,evryone,</DIV>
<DIV> I want to use vtkImageData read a raw datasets 256*256*256, and I followed an example from the internet. I reconstruct the datasets,but it shows part of the 3D reconstruction. Could anyone help me? thanks.</DIV>
<DIV> </DIV>
<DIV>code:<BR> unsigned short *buf;<BR> buf = new unsigned short[256*256*117];<BR> unsigned short *p=buf;<BR> FILE *fp = fopen( filePath,"r"); <BR> fread(buf,256*256,117,fp);<BR> fclose(fp);</DIV>
<DIV><BR> vtkImageData* id = vtkImageData::New();<BR> id->SetDimensions(256, 256, 117); <BR> // id ->GetPointData()->SetScalars(array) ;<BR> id->SetSpacing(1.0,1.0,1.0);<BR> id->SetOrigin(0.0,0.0,0.0);<BR> id->SetScalarTypeToUnsignedShort(); <BR> id->SetNumberOfScalarComponents(1); <BR> id->AllocateScalars(); </DIV>
<DIV><BR> unsigned short* a = (unsigned short*)(id->GetScalarPointer()); <BR> for (i = 0; i < dims[2]; i++) <BR> { <BR> for (j = 0; j < dims[1]; j++) <BR> { <BR> for (k = 0; k < dims[0]; k++) <BR> { <BR> *a = *p; a++; p++;<BR> } <BR> } <BR> } <BR></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> mexiao</DIV><br><!-- footer --><br><span title="neteasefooter"/><hr/>
<a href="http://count.mail.163.com/redirect/footer.htm?f=http://gouwu.youdao.com">200万种商品,最低价格,疯狂诱惑你</a>
</span>