-
Hi! I am trying to use MONAILabel with 3D Slicer to segment some 2D images, but I am facing the following problem: when I use the "Next Sample" button, it considers that my 2D images in the studies directory are just slices and load them all at once as a single volume. I tried using the dataset both as .png images and as .nii.gz volumes of depth 1 and the same happens. I've being selecting each image manually through the "Add Data" option and have modified some code of the radiology app to make the active learning work properly to my problem and I can confirm that it works well, but I lose the agility and nice randomness of the MONAILabel's random strategy. As a workaround I tried adding a zeroed layer to my NIfTI files in order to transform my images into volumes of depth 2 and the button started to work as I expected (one image at a time), so the problem is really related to 2D. Is this behaviour expected? In this case, is there a proper way to change it to consider each 2D image as a single image (or volume of depth 1)? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@Jpvmello , thanks for the question. 3D Slicer and the monai label plugin should support loading 2D images with "Next Sample". I guess the datastore file system structures matters. If 2D images are put in a folder with different names (format .png, .jpg or nifti), datastore will consider each separate file as a "subject". To double check the datastore, you can find this "datastore_v2.json" file under the studies directory, and see whether each 2D image is considered as a data entry. For example: Here is an example of a loaded 2D dataset's datastore JSON file: {
"name": "new-dataset",
"description": "New Dataset",
"images_dir": ".",
"labels_dir": "labels",
"objects": {
"Video_7_2020_01_13_Video1_f14460": {
"image": {
"ext": ".jpg",
"info": {
"ts": 1673278105,
"name": "Video_7_2020_01_13_Video1_f14460.jpg"
}
},
"labels": {}
},
"Video_7_2020_01_13_Video1_f15360": {
"image": {
"ext": ".jpg",
"info": {
"ts": 1673278105,
"name": "Video_7_2020_01_13_Video1_f15360.jpg"
}
},
"labels": {}
},
"Video_7_2020_01_13_Video1_f15660": {
"image": {
"ext": ".jpg",
"info": {
"ts": 1673278105,
"name": "Video_7_2020_01_13_Video1_f15660.jpg"
}
},
"labels": {}
},
} |
Beta Was this translation helpful? Give feedback.
-
It ended up that my workmate figured the problem out: my filenames are sequential (0, 1, 2, ...), so Slicer interpreted as slices. Previously I tested inserting a letter (i0, i1, ...) but in fact it kept being a sequence. Now, I've tested renaming each file with an individual string and it worked. Thanks a lot for the attention! |
Beta Was this translation helpful? Give feedback.
It ended up that my workmate figured the problem out: my filenames are sequential (0, 1, 2, ...), so Slicer interpreted as slices. Previously I tested inserting a letter (i0, i1, ...) but in fact it kept being a sequence. Now, I've tested renaming each file with an individual string and it worked. Thanks a lot for the attention!