[vtkusers] Reading DICOM in ITK, showing with right orientation in VTK
Lodron, Gerald
Gerald.Lodron at joanneum.at
Wed Nov 4 03:07:35 EST 2009
Hello,
I currently succesfully read a 3D dicom file with itk::ImageSeriesReader and write the image into an itk::OrientedImage< signed short, 3 >. After that i convert the image to VTK using the ImageToVTKImageFilte and visualized it. My problem is that the orientation is wrong (the head in the DICOM image is downside, the feets are on the upside). In the DICOM file there should be a Orientation tag which should refer to left/right etc. How can I connect this information so that an arbitrary DICOM image is always displayed correctly (from front side with the head upside)? Here is my current code:
PS: Is there a possibility tho get the data type form the DICOM, currently I always read signed short and i am not sure if this is correct for every dicom.
typedef signed short PixelType;
const unsigned int Dimension = 3;
Typedef itk::OrientedImage< PixelType, Dimension > ImageType;
typedef itk::ImageSeriesReader< ImageType > ReaderType;
typedef itk::GDCMImageIO ImageIOType;
typedef itk::ImageToVTKImageFilter<ImageType> ITKVTKConnectorType;
typedef itk::GDCMSeriesFileNames NamesGeneratorType;
ReaderType::Pointer m_Reader = ReaderType::New();
ImageIOType::Pointer m_DicomIO = ImageIOType::New();
NamesGeneratorType::Pointer m_NameGenerator = NamesGeneratorType::New();
ITKVTKConnectorTypePointer m_Connector = ITKVTKConnectorType::New();
m_Reader->SetImageIO( m_DicomIO );
m_NameGenerator->SetUseSeriesDetails( true );
m_NameGenerator->SetDirectory( path );
Std::vector<std::string> m_strUIDs = m_NameGenerator->GetSeriesUIDs();
Std::string m_strFileNames = m_NameGenerator->GetFileNames(m_strUIDs.at(0) );
m_Reader->SetFileNames( m_strFileNames );
m_Reader->Update();
m_Connector->SetInput(m_Reader->GetOutput());
m_Connector->Update();
vtkImageData* vtkIm = m_Connector->GetOutput();
//Visualization, e.g. image plane widget example
More information about the vtkusers
mailing list