What’s the risk of changing representation?
Due to I need to use pyradiomics, I need to change Dicom to NRRD, so I need to use binary labelmap, however, every time I click make master, a warning screen pop up, and tell me there is risk of losing important information!
What kind of important information may be lose? Does lose the data affect pyradiomics feature computing? Thanks for your help!
Do you import segmentation from RT structure sets?
Yes, so I need to change representation to get RTstruct NRRD file
In RT structure sets, each structure is defined by a set of parallel contours. NRRD file is a binary labelmap representation. Conversion is always lossy because the straight contour lines are sampled at a finite resolution (the labelmap’s resolution).
By default, the conversion happens at the chosen master volume’s resolution, which is usually sufficient, as the segmentation was originally created from that image. You can visually verify that the converted segment contains all the clinically relevant details.
I am newbie in CV. I am still confused! If the resolution of Dicom and NRRD doesn’t change, why we need to sample ? Thanks for your help!
Contour point positions in RT structure sets have practically infinite resolution (coordinate values are stored as 64-bit floating point values), while images always have a specific resolution. When you convert from contours to images you need to decide what image resolution to use.
Using the original input image’s resolution should work well in all cases except rare cases of very small or very thin structures. If your structures are like that then you may decide to oversample the original image when creating the labelmap representation (Segmentations module / Representations section / Binary labelmap -> Update, in the displayed dialog, choose conversion path and adjust “Oversampling factor”).
I try to do as you say, adjust “Oversampling factor”, but there are two options when I click, also there is a value called “Estimated relative cost”, what is that? Thanks for your help!
It is a ballpark number for how long the conversion takes. It is considered when the mechanism chooses a conversion path between two representations automatically.
Do these two methods give different results? If the result is similar, why do we need two methods, thanks for your help!
You can develop and register any number of conversion algorithms between any representations. As a result, you end up with multiple ways of getting from one representation to the other. Usually a direct conversion step is better, but you are free to choose and compare the various available options and use the one that works best for you.
So if I only click make master, the result will be direct tranformation? If I want different pathway, then I should click update; or only clicking make master will choose the least cost way in the update panel? Which one is correct?
By default the conversion with the shortest total path is used. If you want to apply a non-default conversion path then you need to click update, chose a different conversion path, and click “Convert”. Note that manual override is not remembered, so if you convert again automatically (e.g., you remove a representation and create it again with default settings) then it will use the default path.
Are the RTstruct file stored as vector graph? If the RTstruct file is a vector graph, when I transform it into bitmap, it is lossy. Is it right?
RTStruct is stored in a series of 2D contours, described by a set of points for each contour. It is a legacy representation, that is very hard to create well for complex structures, and hard to convert to more manageable formats. See the first image on this page. It shows just the RTSS conversions.
Probably you don’t realize how hard it is to do this correctly. For example, when a slice intersection has a hole (this happens even when the segment does not have an internal cavity, but simply has a concavity) then it is saved into a single contour using “keyhole” technique. You need to detect and reverse-engineer keyholes when you rasterize the contour. End-capping of contours is not trivial either (you don’t want to abruptly end a segment at the first and at the last contour’s position). To reduce information loss, you often need to oversample the contour, but it means that you need to robustly and smoothly interpolate contours. Robust contour interpolation is hard because RT structure sets normally don’t contain connectivity information (which contours of neighbor slices are connected to each other), so you need to detect connections, branching, and terminations. These are all solved quite well in SlicerRT’s converter - tested on many data sets, by many users, over several years.
So, your options are something like these:
- A. use a naive contour rasterization algorithm: you can only use native resolution (no oversampling, so you may lose lots of information, which can be very significant for small or thin structures) and you must manually review and potentially correct all conversion errors (due to keyholes etc.)
- B. Use SlicerRT’s converter
- C. Get rid of contours and only use labelmap representation for segmentation (this is the safest and most efficient, unfortunately not always feasible, if you must interface with radiotherapy software that can only work with contours)