# Cropping a CT volume

**URL:** https://discourse.itk.org/t/cropping-a-ct-volume/3302
**Category:** Beginner Questions
**Created:** [July 19, 2020, 12:50pm UTC](https://discourse.itk.org/t/cropping-a-ct-volume/3302 "2020-07-19T12:50:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![blizzardboi\_2020](https://discourse.itk.org/letter_avatar_proxy/v4/letter/b/13edae/32.png) [@blizzardboi\_2020](https://discourse.itk.org/u/blizzardboi_2020)
#### Post date: [July 19, 2020, 12:50pm UTC](https://discourse.itk.org/t/cropping-a-ct-volume/3302/1 "2020-07-19T12:50:18Z")

</div>

Hello. I want to crop(28x28x50) all the dcm (CT) volumes(150x150x50) in a folder, any python script for that?

---

<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: [July 19, 2020, 8:58pm UTC](https://discourse.itk.org/t/cropping-a-ct-volume/3302/2 "2020-07-19T20:58:18Z")

</div>

Hello @blizzardboi_2020,

Not sure if you are using ITK or SimpleITK. If SimpleITK, then please take a look at [this example script](https://simpleitk.readthedocs.io/en/master/link_DicomSeriesReadModifyWrite_docs.html) which reads-modifies-writes a DICOM volume.

To extract a sub-volume from a volumetric image, just use the slicing operator. Please see [this Jupyter notebook](https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Python/03_Image_Details.ipynb) for further details on slicing and general image operations in SimpleITK.

---

<div class="post-metadata">

### Author: ![blizzardboi\_2020](https://discourse.itk.org/letter_avatar_proxy/v4/letter/b/13edae/32.png) [@blizzardboi\_2020](https://discourse.itk.org/u/blizzardboi_2020)
#### Post date: [July 20, 2020, 3:28am UTC](https://discourse.itk.org/t/cropping-a-ct-volume/3302/3 "2020-07-20T03:28:24Z")

</div>

Actually I want to get this done for all the patients data in a folder, and in each patients folder there are Dixon files. I just a script for that in ITK/SITK!
