# Transforme segmentaion

**URL:** https://discourse.slicer.org/t/transforme-segmentaion/29150
**Category:** Support
**Tags:** segmentation, dicom
**Created:** [April 26, 2023, 8:31pm UTC](https://discourse.slicer.org/t/transforme-segmentaion/29150 "2023-04-26T20:31:42Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![Thirawat](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/thirawat/32/65667_2.png) [@Thirawat](https://discourse.slicer.org/u/Thirawat)
#### Post date: [April 28, 2023, 4:31am UTC](https://discourse.slicer.org/t/transforme-segmentaion/29150/5 "2023-04-28T04:31:46Z")

</div>

Thank you very much now I find a way to manage with this problem.

my problem: Creating a segmentation dataset with CT has transformed. but Python cant read the CT transform and can only read raw CT.

so I solve it by creating an inverted transform segmentation.  
for more details:

- I have CT .dcm with transformed. and have segmentation nrrd.
- Import segmentation as volume.
- Clone transform form CT to segmentation volume.
- Invert transform and Edit properties to apply to segmentation volume.  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/f/3f860f6198cc3cbf0419739e4043978744152989.png)
- then “Harden transform” segmentation.  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/2/02fb00f97f50d5c20cd3962c52d4a263b3b32d8a.png)  
and save it as dicom.

for the shape problem that will change I slove in Python (just cut it off):

```auto
# read dicom filse (CT, mask)
ct_image_array = readCT(dir_ct_paths[n])
label_image_array = readLabel(dir_label_paths[n])

# preprocess mass
label_image_array = label_image_array[:ct_image_array.shape[0], :512, :512]

```

---

_[View the full topic](https://discourse.slicer.org/t/transforme-segmentaion/29150)._
