Questions about comparing segments with the Segment Comparison module

Dear Developers and Users

Is it possible to compare the segment of a specific organ, e.g. liver, (from CT images) in two different patients?

Basically, is it reasonable to directly compare such segments (from two different patients) using the Segment Comparison module? Because the coordinate space of patients’ CT images seems to be different, it may not be correct to do this and maybe it is necessary, for example, to equalize the centers of the image space at firstly.

I investigated this by following the steps below.

1- I once compared the liver segments of two patients, without doing anything, with Segment Comparison module. Their Dice coefficient was equal to zero.

2- Once again, I first converted the segments of two patients into labelMapVolume. Then I converted both to Volume and used Center Volume option in Volume module. I re-segmented the resulting nodes with the Threshold filter in the Segment Editor module with lower and upper limits equal to 1. Finally, I calculated Dice Coefficient with Segment Comparison module. This coefficient was equal to 0.566832.

Based on this experience, I concluded that the spatial position of the two segments is dependent on the coordinate space of the initial CT images of the two patients, and this issue completely affects the value of the Dice coefficient.

Please guide me in understanding this difference.

My main question is this:
How can I calculate the similarity of two segments without this dependency?

Please guide me.
Best regards.

I think what you need to do is proper registration of the two patients. You can read about this concept here Registration — 3D Slicer documentation

If you want to focus on just one organ, instead of trying to do a good global registration, you can use the Segment Registration module from the extension that has the same name.

Thank you very much Csaba for your guidances.
As you suggested, I first used the Segment Registration module to register the segments.
Assume that the input data includes the following:

Patient 07:
CT07.nii (Information: 128x128x108, 3.912x3.912x5.000 mm)

Patient 45:
CT45.nii (Information: 512x512x127, 0.978x0.978x5.000 mm)

The input data to 3DSlicer is shown in the figure below.

The input data to the Segment Registration module is shown in the figure below.

Click on Perform Registration to start the process. In this registration, the Rigid option is disabled (I do not want the geometry of the segment to change in any way, then I must select Rigid option). The result is shown in the figure below.

As mentioned above, I just want the registration to be done via Rigid Transform only. So the Rigid option was selected and Perform Registration was done again. Is this correct?

As you can see In the picture before the picture above, the Rigid option is disabled and this Rigid option is enabled for me after completing the previous step. The result of this step and the resulting outputs are shown in the following figure:

Now I will segment two nodes named Fixed_Structure_Padded_1-Cropped and Moving_Structure_Padded_1-Cropped.

The result is shown in the figure below:

In the last step, the Segment Comparison module was used with the following settings and output.

Do you think these steps are correct, specially selecting the Rigid option in the second use of the Segment Registration module?

If the above steps are correct, how can I do the last step via command line? In other words, can the Segment Comparison module be executed through the command line?
The reason for this requirement is that my data is relatively large and doing these steps through the GUI is time-consuming.

Best regards.

It seems correct to me. When you change the type of registration from deformable to rigid, it is only a visualization thing, meaning that the deformable registration is simply not applied. So no need to do the perform registration step again.

Thanks a lot Csaba for your reply.

Please guide me regarding my last question.
As mentioned in my message, how can I do two steps including as at first Segment Registration and then Segment Comparison modules in command line of terminal.
As mentioned, I have a lot of data of images for which I have to calculate the dice coefficient in pairs. It would be nice to be able to do these steps (two modules) in the command line.

Please guide me.
Best regards.