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

David Gobbi david.gobbi at gmail.com
Thu Jan 12 08:23:52 EST 2017


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/06d7f1c1/attachment.html>


More information about the vtkusers mailing list