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

Teh Sunn Liu tehsunnliu at yahoo.com
Thu Jan 12 08:52:26 EST 2017


Hello David.I'm like wow. I didn't know that there was vtkDICOMReader too. I spent so many days figuring out lol. And I installed vtkDICOM before then I removed it while installing GDCM.
Thank you so much for informing me about vtkDICOMReader. I'll update my post so other people will know.
Alex 

    On Thursday, 12 January 2017 9:24 PM, David Gobbi <david.gobbi at gmail.com> wrote:
 

 Hi Alex,
You can also try the vtkDICOMReader that comes with vtk-dicom. It provides easy access to all of the meta-data, rather than just the limited amount of information in the MedicalImageProperties object.
http://dgobbi.github.io/vtk-dicom/doc/api/pages.html

Cheers,  - David
On Wed, Jan 11, 2017 at 11:04 PM, Alex Liu via vtkusers <vtkusers at vtk.org> wrote:

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
2-GDCM_BUILD_SHARED_LIBS
3-GDCM_BUILD_APPLICATIONS
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
2-USE_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 =
vtkSmartPointer< vtkGDCMImageReader>::New();
reader->SetFileName(filename. c_str());
reader->Update();
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




   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170112/f8f2785d/attachment.html>


More information about the vtkusers mailing list