[vtkusers] CT image scalars

Lisa Avila lisa.avila at kitware.com
Tue Sep 30 13:09:28 EDT 2003


Hello Chi,

You need to do a

v16->Update();

before you can get the output (otherwise the output is empty as you have 
determined)

Lisa


At 11:25 AM 9/30/2003, X. Chi wrote:
>Hi, all
>
>I have a question on CT image scalars. I was trying to get the scalars 
>from image data once I read it in my program. The following is the code:
>
>vtkVolume16Reader *v16 = vtkVolume16Reader::New();
>
>    v16->SetDataDimensions (64,64);
>    v16->SetImageRange (1,93);
>    v16->SetDataByteOrderToLittleEndian();
>    v16->SetFilePrefix ("headsq/quarter");
>    v16->SetDataSpacing (3.2, 3.2, 1.5);
>
>vtkImageData *id = vtkImageData::New();
>id=v16->GetOutput();
>for(int i=0; i<64; i++)
>for(int j=0; j<64; j++)
>printf("show scalars:%f\n", id->GetScalarComponentAsFloat(j, i, 32, 0));
>
>
>After the testing, the program printed out all the scalars are zero.
>
>Could anybody tell me what the problem is? Thank you for your help.
>
>Chi
>
>_________________________________________________________________
>Instant message during games with MSN Messenger 6.0. Download it now FREE!
>http://msnmessenger-download.com
>
>_______________________________________________
>This is the private VTK discussion list. Please keep messages on-topic. 
>Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers






More information about the vtkusers mailing list