Issue with mask exported from Slicer

Hi, I am working on a project which requires me to perform radiomics analysis on ROIs exported from different software, including Slicer. The software I am using to perform the analysis is LifeX and I am also using CERR and MICE to create ROIs. I have however noticed that the ROI exported from Slicer is rotated and of the wrong size and resolution compared to those from other software. I am using the following instructions to export the ROI as both a Nifty and NRRD file: Segmentations — 3D Slicer documentation

The data I am using is this:

As you can see, the size of the original CT image is 198x202x59 whereas the mask exported from slicer has the dimensions 239x248x264 which is what is causing the problem.
Are there any settings I could use to create a binary mask with the same size as the CT matrix?

It seems that the other software that you use do not take into account physical space information correctly. For compatibility with such software, you can choose a reference volume when you export the segmentation (it will make the exported labelmap geometry match the geometry of the reference volume).

Thanks for your answer!
Unfortunately I think the problem is with the way the ROI is exported…
See below the LifeX interface

It is clear that the ROI exported from the other software I am using (MICE and CERR) all match whereas that exported from Slicer (in green) is clearly wrong.
The exported mask also doesn’t match with that created in Slicer which suggests that the export function is wrong?
What steps can I take to avoid this?

What format you export the segmentation to: nrrd, nifti, stl, obj, DICOM Segmentation Object, or DICOM RT structure set?
How do you export from Slicer - export to files feature, export to model/labelmap and save, or using DICOM export data in Data module?

I’ve downloaded the data and checked where Slicer gets the exported labelmap geometry and I’ve found that the DICOM data sets are not created correctly. RT structure sets must reference image frames that they are created from. The STS_001 validation data set’s structure set contains invalid references:

Referenced series instance UID in RT structure set:

[0020,000e]	SeriesInstanceUID	UI	64

Series instance UID of the CT image:

[0020,000e]	SeriesInstanceUID	UI	64

ReferencedSOPInstanceUIDs listed in the RT structure set file do not match any of the UIDs in the CT image either.

Please report this error to the maintainers of this data set.

Consequence of these invalid references that the RT structure set does not get associated with the CT automatically (Slicer can work with many CTs and structure sets simultaneously, so the fact that you only loaded a single CT so far does not make Slicer assume that it should be used as reference geometry).

You can set the CT as the reference geometry for the structure set in Segmentations module:

Note that the binary labelmap representation that Slicer created without this association were completely valid, too. If they loaded incorrectly in some other software then report this error to their developers. It is OK if a software cannot handle segmentations and and CT images with different geometries (use different origin, spacing, axis direction, or extent), but then the software should detect this and display an error instead of showing incorrect result.

Hi, thank you so much for looking into this! I have followed your steps and LifeX is now displaying the correct position and size from the Slicer export! I suspect I will need to do this for every data set?

Regarding the error in LifeX, I did actually get an error message when importing the old ROIs: Screenshot (64)
This obviously does not show up anymore so thanks again!

You can ask maintainers of these test data sets to fix the DICOM references (maybe only some of them are broken). If they are not willing to do that and you don’t want to do this manually for many data sets then you can write a Python script that does this automatically (along with any other processing steps that to plan to do in Slicer).