[Insight-users] [ITK Community] modify spacing of an 3D image slice

Brian Helba brian.helba at kitware.com
Thu Nov 7 19:06:16 EST 2013


Hi Omar,

Are you using GDCM or DCMTK as your reader?

Also, are you explicitly calling "reader->Update()" at some point before /
after calling "reader->GetOutput()->SetSpacing(..)"?

Thanks,
Brian


On Wed, Nov 6, 2013 at 12:40 PM, O Hamo <ohamo at live.de> wrote:

> Hello,
>
> I am reading a single image slice belonging to an DICOM CT series.
> The component type is short and number of dimension is 3.
> Now I want to modify the voxel spacing.
> To do that I tried this:
> double newSpacing[3];
> newSpacing[0] = x_spacing;
> newSpacing[1] = y_spacing;
> newSpacing[2] = z_spacing;
> reader->GetOutput()->SetSpacing(newSpacing);
> but this will modify only x- and y-spacing while z remains the same (=1mm)
> Also writing z_spacing to the header entry 0018,0050 (Slice Thickness)
> won`t change the fact,
> that calling GetSliceSpacing() at the resulting image will return the
> values of x-and y-spacing but still 1 instead of z-spacing.
>
> How can the 3rd spacing component be modified?
> Is this even possible for the givien image?
> Because Im assuming that ITK is calculating the spacing by using
> ImagePositionPatient(0020,0032) and ImageOrientationPatient(0020,0037),
> but sets it by default to 1 when it cant find more than one slice. (Just a
> guess)
>
> Any help is apreciated.
>
> Kind Regads,
> Omar
>
> _____________________________________
> 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://www.itk.org/mailman/listinfo/insight-users
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>
>


-- 
Brian Helba
Medical Imaging
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20131107/7013f323/attachment.htm>


More information about the Insight-users mailing list