[vtkusers] vtkDICOMImageReader: shift, scale, scalar types

EvilMax maxim.privalov at gmail.com
Sun Feb 27 07:24:40 EST 2011


Hello!

I have some issues reading DICOM studies to further visualization. I'm using
vtkImageShiftScale to read data corectly. Trouble that I need to build
volume on CT datasets that has 12 bits stored or 16 bits stored and with
different scalar ranges. After shift and scale I have situation that same
opacity and color transfer functions are not working on some datasets while
working on another. Here is the code:

		vtkDICOMImageReader reader = new vtkDICOMImageReader();
		reader.SetDirectoryName(getDataRoot());
		reader.Update();
		vtkImageData data = reader.GetOutput();

		/* Check requirements of conversion */
		if (data.GetScalarTypeAsString().compareTo("unsigned char") != 0
				|| data.GetScalarTypeAsString().compareTo("unsigned short") != 0)
		{
			vtkImageShiftScale shiftScale = new vtkImageShiftScale();
			shiftScale.SetInput(data);
			shiftScale.SetShift(-reader.GetRescaleOffset());
			shiftScale.SetScale(1);
			shiftScale.SetOutputScalarTypeToUnsignedShort();
			shiftScale.Update();
			setVolume(shiftScale.GetOutput());
		}
		else
		{
			setVolume(data);
		}
	

-- 
View this message in context: http://vtk.1045678.n5.nabble.com/vtkDICOMImageReader-shift-scale-scalar-types-tp3402171p3402171.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list