# Get ROI size in pixels

**URL:** <https://discourse.slicer.org/t/get-roi-size-in-pixels/18665>\
**Category:** Support\
**Created:** [July 13, 2021, 7:38am UTC](https://discourse.slicer.org/t/get-roi-size-in-pixels/18665 "2021-07-13T07:38:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xackey](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/xackey/32/10860_2.png) [@xackey](https://discourse.slicer.org/u/xackey)\
**Post date:** [July 13, 2021, 7:38am UTC](https://discourse.slicer.org/t/get-roi-size-in-pixels/18665/1 "2021-07-13T07:38:34Z")

</div>

Dear lassoan

Could you teach me how to determine the ROI size by number of pixels, not millimeter?  
My goal is to set both L-R and P-A ranges into 100 pixels, and make a cropped volume with x and y lengths = 100 pixels.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 13, 2021, 1:58pm UTC](https://discourse.slicer.org/t/get-roi-size-in-pixels/18665/2 "2021-07-13T13:58:08Z")

</div>

Spacing of a volume may be anisotropic (different voxel size in different directions) and even be different in different parts of the volume (if a warping transform is applied to the volume). Therefore, the only thing that you can easily and reliably compute is correspondence between physical (RAS) coordinates and voxel coordinates (IJK) as shown in [this example](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#get-volume-voxel-coordinates-from-markup-fiducial-ras-coordinates).

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 13, 2021, 1:59pm UTC](https://discourse.slicer.org/t/get-roi-size-in-pixels/18665/3 "2021-07-13T13:59:05Z")

</div>


