[vtkusers] question about vtkOpenGLVolumeRayCastMapper

Sean McInerney seanm at nmr.mgh.harvard.edu
Wed Dec 15 14:00:29 EST 2004


Hi kingaza,

   You don't want to call SetDataScalarTypeToUnsignedShort on your 
reader since your *input* data do not seem to be unsigned shorts. You 
want to pass the output of your reader to vtkImageShiftScale to shift 
and rescale the range of values from your *input* data to that of 
unsigned char (0 - 0xff) or unsigned short (0 - 0xffff), also setting 
the *output* type of this filter to UnsignedChar or UnsignedShort. The 
output of this filter is then passed to the RaycastMapper.

-Sean

kingaza at gmail.com wrote:
> hi seanm and all, 
> i am new in vtk, and now i am learning from other's samples
> please help me and tell me where i made mistake
> 
> my codes like these:
> 
> vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
> reader->SetDirectoryName("E:\\myhead");	
> reader->SetDataScalarTypeToUnsignedShort(); //it doesn't work!!!!!!!!
>  ......
> vtkVolumeRayCastMapper *volMapper = vtkVolumeRayCastMapper::New();
> volMapper->SetInput(reader->GetOutput());
> vtkVolumeRayCastMIPFunction *MIPFunction = vtkVolumeRayCastMIPFunction::New(); 
> MIPFunction->SetMaximizeMethodToScalarValue();
> volMapper->SetVolumeRayCastFunction(MIPFunction);
> 
> vtkVolume *vol = vtkVolume::New();
> vol->SetMapper(volMapper);
> 
> vtkRenderer *ren = vtkRenderer::New();
> ren->AddVolume(vol);	
> 
> 
> 
> On Wed, 15 Dec 2004 12:28:07 -0500, Sean McInerney
> <seanm at nmr.mgh.harvard.edu> wrote:
> 
>>Hi kingaza,
>>
>>  Use vtkImageShiftScale to shift and rescale the range of values in
>>your data to that of unsigned char (0 - 0xff) or unsigned short (0 -
>>0xffff), also setting the output type of this filter to UnsignedChar or
>>UnsignedShort.
>>
>>-Sean
>>
>>kingaza at gmail.com wrote:
>>
>>>hi all,
>>>in my application, i use vtkVolumeRayCastMapper to implement
>>>ray-casting. i have succeeded in implementing raycasting using volume
>>>data,  but when i use dicom file as input source,  one error occurs
>>>as:
>>>ERROR: In .\vtkVolumeRayCastMapper.cxx, line 326
>>>vtkOpenGLVolumeRayCastMapper (01C0CCF0): Cannot volume render data of
>>>type short, only unsigned char or unsigned short.
>>>
>>>how can i do? should i convert dicom file to another format first?
>>>
>>>regards,
>>>kingaza
>>>_______________________________________________
>>>This is the private VTK discussion list.
>>>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>Follow this link to subscribe/unsubscribe:
>>>http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>
> 



More information about the vtkusers mailing list