[vtkusers] How to get patient's information using vtkMedicalImageReader2 ?

Alex Liu tehsunnliu at yahoo.com
Thu Jan 12 01:04:27 EST 2017

For those who are struggling with this I found a solution.
first vtkDICOMImageReader doesn't support getting DICOM image properties for
now(tested in vtk v7). 
To read DICOM image properties you need to download GDCM  can be downloaded
from here <https://sourceforge.net/projects/gdcm/>  

after download and extracting GDCM you need to open CMake
in CMake Check those attributes 
1-GDCM_USE_VTK and select VTK_DIR and vtk directory
now click configure and generate. Use your compiler to build it.

In my case I got error while building GDCM that it could not find vtk lib
files. which I already had in the folder. So I had to edit
gdcm-2.6.6/build/cmake_install.cmake file under INSTALL DESTINATION I had to
add lib in front of vtkCommonCore-7.0.dll and the rest of the files, since
in my vtk bin folder all my files had lib prefix.

once GDCM is ready now you need to configure vtk
open vtk in CMake and set and check those attributes
1-GDCM_DIR select the build directory of GDCM
now configure and generate.
now you are ready to build vtk.

next thing you need to do is set environment variable for gdcm and import
lib to your project.
now you are ready to use GDCM

To get DICOM image properties you need to do the following

vtkSmartPointer<vtkGDCMImageReader> reader =
reader->GetMedicalImageProperties()->GetPatientName(); // to get Patient
Name as an example

double w,l;
reader->GetMedicalImageProperties()->GetNthWindowLevelPreset(0, &w, &l); //
get window width and window level.

Hope this helps.

for any question you can send me an email at tehsunnliu at yahoo.com

Alex Liu
View this message in context: http://vtk.1045678.n5.nabble.com/How-to-get-patient-s-information-using-vtkMedicalImageReader2-tp3350060p5741764.html
Sent from the VTK - Users mailing list archive at Nabble.com.

More information about the vtkusers mailing list