# Do segmentation on dicom volume

**URL:** <https://discourse.itk.org/t/do-segmentation-on-dicom-volume/2695>\
**Category:** Uncategorized\
**Created:** [February 9, 2020, 8:01pm UTC](https://discourse.itk.org/t/do-segmentation-on-dicom-volume/2695 "2020-02-09T20:01:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![flaviu2](https://discourse.itk.org/letter_avatar_proxy/v4/letter/f/74df32/32.png) [@flaviu2](https://discourse.itk.org/u/flaviu2)\
**Post date:** [February 9, 2020, 8:01pm UTC](https://discourse.itk.org/t/do-segmentation-on-dicom-volume/2695/1 "2020-02-09T20:01:08Z")

</div>

I have found some similar post here, but they are not clear me enough, so forgive me if I put here a too simple question.

I have a VC++ app that read dicom images (with VTK DICOM library). I am using for that vtkDICOMReader. Excellent class. Work good. And from dicom images I build a vtkVolume. Now it comes the hard work (for me). How can I use on this vtkVolume a SimpleITK segmentation in such a way to still read the segmentation outcome with my vtkDICOMReader and then vtkVolume ?

Why I ask that ? The SimpleITK/ITK examples are using simple images like input, and use the same simple image format for output … in my case I need to do segmentation on my dicom images. At least, how can I do repeat segmentation on every dicom image in order to loaded again into my vc++ app ?

I don’t know how to find a solution to my task, so please help me.

---

<div class="post-metadata">

**Author:** ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)\
**Post date:** [February 10, 2020, 2:19pm UTC](https://discourse.itk.org/t/do-segmentation-on-dicom-volume/2695/2 "2020-02-10T14:19:05Z")

</div>

If you want to transfer an image from VTK to SimpleITK you will have to import the buffer and set the image metadata (spacing/origin/direction cosine) explicitly.

Please see [this SimpleITK example for buffer importing](https://github.com/SimpleITK/SimpleITK/blob/master/Examples/BufferImportExport.cxx) and [this stack overflow discussion](https://stackoverflow.com/questions/36290662/send-img-vtk-for-itk) for exporting the buffer from VTK (the discussion talks about importing into an ITK image and the approach is similar for a SimpleITK image).

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [February 10, 2020, 3:38pm UTC](https://discourse.itk.org/t/do-segmentation-on-dicom-volume/2695/3 "2020-02-10T15:38:39Z")

</div>

@flaviu2 have you considered reading the DICOM series using SimpleITK’s classes? [Example](https://simpleitk.readthedocs.io/en/master/link_DicomSeriesReader_docs.html).

---

<div class="post-metadata">

**Author:** ![flaviu2](https://discourse.itk.org/letter_avatar_proxy/v4/letter/f/74df32/32.png) [@flaviu2](https://discourse.itk.org/u/flaviu2)\
**Post date:** [February 10, 2020, 3:43pm UTC](https://discourse.itk.org/t/do-segmentation-on-dicom-volume/2695/4 "2020-02-10T15:43:26Z")

</div>

@dzenanz I don’t know if is good idea, because my VC++ app already read input data with vtk classes. I only need to migrate vtk data into SimpleITK for segmentation operation and I have to translate it back for visual representation. I meant, will be more complicated to read data with ITK and represent it with VTK …

---

<div class="post-metadata">

**Author:** ![pip010](https://discourse.itk.org/user_avatar/discourse.itk.org/pip010/32/1363_2.png) [@pip010](https://discourse.itk.org/u/pip010)\
**Post date:** [March 5, 2020, 10:42am UTC](https://discourse.itk.org/t/do-segmentation-on-dicom-volume/2695/6 "2020-03-05T10:42:40Z")

</div>

AFIK using VTK IO one can only read a slice !? You do need itk/gdcm for a 3D volume !?

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [March 5, 2020, 3:53pm UTC](https://discourse.itk.org/t/do-segmentation-on-dicom-volume/2695/7 "2020-03-05T15:53:19Z")

</div>

VTK can also read a DICOM series, see [example](https://vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOMSeries).
