Re: [ITK-users] extract middle slice from dicom files

Dženan Zukić <[email protected]> Fri, 17 Nov 2017 14:25:45 -0500
Newsgroups gmane.comp.lib.itk.user
Message-ID <CAPf2UMQqngQS_ACeYr954h34ORw6Woe8sQezYvDy7YEbzRe+Ug@mail.gmail.com>
Hi Swetha,

the simplest, but not computationally most efficient, is to load
<https://itk.org/ITKExamples/src/IO/GDCM/ReadDICOMSeriesAndWrite3DImage/Documentation.html>
the series as a 3D image and then access the middle slice:

image3d=reader->GetOutput();
ImageType::IndexType ind=image3d->GetBufferedRegion().GetIndex();
ind[2]=image3d->GetBufferedRegion().GetSize()[2]/2; //middle
slicePixel00=image3d->GetPixel(ind);

Less computation, but more code would be to examine spatial position of
each slice in seriesUID and then just load the one closest to the middle.

We are in the process of switching to discourse <https://discourse.itk.org/>,
please post follow-up questions there.

Regards,
Dženan

On Fri, Nov 17, 2017 at 9:54 AM, Swetha Sharma <[email protected]>
wrote:

> Hi ,
>
> I want to know how to get the image values from middle slice of dicom
> series.
> -swetha
>
> The ITK community is transitioning from this mailing list to
> discourse.itk.org. Please join us there!
> ________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
>
>

The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there!
________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users