View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004392 | Slicer4 | Core: Segmentation | public | 2017-07-05 18:14 | 2017-07-27 08:02 |
Reporter | fepegar | Assigned To | pinter | ||
Priority | high | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | Slicer 4.6.2 | ||||
Target Version | Slicer 4.7.0 | Fixed in Version | Slicer 4.7.0 | ||
Summary | 0004392: Exported segmentation is empty | ||||
Description | When trying to export a segmentation to a label map, the result is empty. | ||||
Additional Information | The colors of the segments come from a custom terminology file. This seems to be the source of the problem (see attached log). If I load the terminology before exporting, I still get the same. | ||||
Tags | No tags attached. | ||||
HumanBrainstemTerminology.json (78,804 bytes) TC4_903_rgb_small.nii.gz (1,554,748 bytes) TC4_903_segmentation.seg.nrrd (494,671 bytes) |
|
Thanks for the detailed report! Your assessment makes sense. I'll fix it shortly. |
|
Apparently I can't paste the whole thing in a note. Here's a link: https://www.dropbox.com/s/vb4nu4yswpsz3xz/HumanBrainstemTerminology.json?dl=0 |
|
Hi Fernando, |
|
I would like to be able to do the conversion even when the Terminology file is not the same that was used to create the segmentation / when the Terminology file is not in the scene. Would that be possible? |
|
Terminology codes should uniquely identify a terminology entry, so a different code will mean a different entry. So if your codes change, and the segmentation contains terminology information using the old codes, the link is "broken". If you want this question to be discussed in more detail, please open a discourse topic, or an issue here https://github.com/QIICR/QuantitativeReporting I see one way out of this, however, which is similar to the way we handle the non-standard DICOM files (this is the same issue practically, as your segmentation's terminology information becomes invalid), namely that we write a simple script that matches the Category and CodeMeaning entries in the segmentation and the terminology, and overwrites the CodeValue entries based on the matches. By the way I just imported the original json file and exported the segmentation, and although I got a lot of warning messages, the resulting labelmap seems OK! |
|
Is there any code change needed and/or just a note in the module documentation? |
|
The problem happened when I tried to export the segmentation using the modified JSON. I still think that should work, even if the codes are different. |
|
From my last comment: |
|
Sorry, I thought you meant that you used the original terminology that was used to create the segmentation. l = slicer.modules.terminologies.logic() I get the warnings and my label map is filled with zeros. I've used the three files I originally uploaded in this issue. I'm using today's nightly. |
|
I used the open button in Terminologies. I just did it again, and it works. Without having your terminology loaded, and with it as well: |
|
Still worked with the terminology. Then it struck me that you mentioned using the volume as reference. I opened Advanced, set the volume as reference, and that is when the volume became empty! |
|
FYI if you load the terminology from python like that it will not be cached, so you have to do that every time. But if you use the load button, then it will be cached, and loaded automatically on every startup afterwards. |
|
I watched your video and the difference is that you don't set the volume node as reference. If a reference is given, the label map is empty. If the reference is None, the labels are ok but not the geometry. |
|
I hadn't read your last two comments. So yes, the reference node seems to be what's causing trouble and not the JSON. Thanks for the info about the button. |
|
Well if we knew that it's not the terminology but the referece, we could have saved a lot of time. Please be very specific about the steps next time. I'll look into this issue now that I can reproduce it. |
|
Ok, next time I'll make sure to include the exact steps. I'm sorry for the trouble. |
|
It seems that the exported labelmap is empty because the reference image is only one slice, and the oriented image data becomes empty when resampling to that reference. When I used a transformed MRHead as reference, then the labelmap was not empty and the segments were in the right place, but stripes appeared in it, probably because as the axes were not aligned, only the voxels were filled where the voxel center of the reference volume was inside the segmentation. This may have to do something with the thin slice reference as well. I'll keep digging. |
|
This is definitely one of the reasons the exported labelmap is empty with a single-slice volume as reference |
|
I did a commit to fix this issue. |
|
Ok, thanks Csaba. I'll let you know what happens tomorrow. |
|
It works fine now, thank you! |
|
Excellent, thanks! I'm closing the issue. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2017-07-05 18:14 | fepegar | New Issue | |
2017-07-05 18:14 | fepegar | Status | new => assigned |
2017-07-05 18:14 | fepegar | Assigned To | => pinter |
2017-07-05 18:14 | fepegar | File Added: HumanBrainstemTerminology.json | |
2017-07-05 18:14 | fepegar | File Added: TC4_903_rgb_small.nii.gz | |
2017-07-05 18:14 | fepegar | File Added: TC4_903_segmentation.seg.nrrd | |
2017-07-05 18:14 | fepegar | File Added: log.txt | |
2017-07-07 18:06 | pinter | Note Added: 0014916 | |
2017-07-10 04:19 | fepegar | OS | Sierra => |
2017-07-10 04:19 | fepegar | OS Version | 10.12.5 => |
2017-07-10 04:19 | fepegar | Platform | Mac => |
2017-07-10 04:21 | fepegar | Note Added: 0014918 | |
2017-07-14 21:00 | pinter | Note Added: 0014919 | |
2017-07-16 08:41 | fepegar | Note Added: 0014920 | |
2017-07-16 18:01 | pinter | Note Added: 0014921 | |
2017-07-24 20:32 | lassoan | Note Added: 0014928 | |
2017-07-24 20:58 | lassoan | Target Version | => Slicer 4.7.0 |
2017-07-25 09:49 | fepegar | Note Added: 0014965 | |
2017-07-25 10:04 | pinter | Note Added: 0014966 | |
2017-07-25 10:16 | fepegar | Note Added: 0014967 | |
2017-07-25 10:42 | pinter | Note Added: 0014970 | |
2017-07-25 10:49 | pinter | Note Added: 0014971 | |
2017-07-25 10:50 | pinter | Note Added: 0014972 | |
2017-07-25 10:51 | fepegar | Note Added: 0014973 | |
2017-07-25 10:53 | fepegar | Note Added: 0014974 | |
2017-07-25 10:59 | pinter | Note Added: 0014976 | |
2017-07-25 11:04 | fepegar | Note Added: 0014977 | |
2017-07-26 14:25 | pinter | Note Added: 0014990 | |
2017-07-26 14:55 | pinter | Note Added: 0014992 | |
2017-07-26 15:02 | pinter | Note Added: 0014993 | |
2017-07-26 15:03 | pinter | Note Edited: 0014993 | View Revisions |
2017-07-26 15:08 | pinter | Status | assigned => resolved |
2017-07-26 15:08 | pinter | Resolution | open => fixed |
2017-07-26 15:08 | pinter | Fixed in Version | => Slicer 4.7.0 |
2017-07-26 15:24 | fepegar | Note Added: 0014994 | |
2017-07-27 05:33 | fepegar | Note Added: 0014999 | |
2017-07-27 08:02 | pinter | Status | resolved => closed |
2017-07-27 08:02 | pinter | Note Added: 0015000 |