# MONAILabel module should allow user to select different volumes in current scene

**URL:** <https://discourse.slicer.org/t/monailabel-module-should-allow-user-to-select-different-volumes-in-current-scene/28522>\
**Category:** Development\
**Tags:** extensions-manager\
**Created:** [March 22, 2023, 2:33pm UTC](https://discourse.slicer.org/t/monailabel-module-should-allow-user-to-select-different-volumes-in-current-scene/28522 "2023-03-22T14:33:16Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [March 27, 2023, 1:21pm UTC](https://discourse.slicer.org/t/monailabel-module-should-allow-user-to-select-different-volumes-in-current-scene/28522/21 "2023-03-27T13:21:08Z")

</div>

I´ll contact you on Discord, maybe we can post a solution later not to push this thread up too often.

---

<div class="post-metadata">

**Author:** ![njeffery123](https://avatars.discourse-cdn.com/v4/letter/n/bc8723/32.png) [@njeffery123](https://discourse.slicer.org/u/njeffery123)\
**Post date:** [October 4, 2023, 11:52am UTC](https://discourse.slicer.org/t/monailabel-module-should-allow-user-to-select-different-volumes-in-current-scene/28522/22 "2023-10-04T11:52:32Z")

</div>

hi @diazandr3s  
I can get this code to work nicely  
python main.py --studies “/home/user/CT-test/” --model “segmentation” --test “infer”

but only on the first dataset in the directory “/home/user/CT-test/”, it then stops. Is there are way to process all datasets in a directory using this approach? I have a good model and I just want it to run through all the datasets in a directory, generating label maps. Very laborious in 3Dslicer using the server and next button.

cheers  
nathan

---

<div class="post-metadata">

**Author:** ![diazandr3s](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/diazandr3s/32/9973_2.png) [@diazandr3s](https://discourse.slicer.org/u/diazandr3s)\
**Post date:** [October 4, 2023, 11:56pm UTC](https://discourse.slicer.org/t/monailabel-module-should-allow-user-to-select-different-volumes-in-current-scene/28522/23 "2023-10-04T23:56:58Z")

</div>

Hi @njeffery123,

This is what’s happening when you run infer: [https://github.com/Project-MONAI/MONAILabel/blob/main/sample-apps/radiology/main.py#L304-L327](https://github.com/Project-MONAI/MONAILabel/blob/main/sample-apps/radiology/main.py#L304-L327)

You could modify the code (add a for loop) to run inference on all the unlabelled images OR by starting the server and running batch inference using the APIs from the browser. This will run inference on all the unlabelled volumes in the folder.

Hope this helps,

---

<div class="post-metadata">

**Author:** ![njeffery123](https://avatars.discourse-cdn.com/v4/letter/n/bc8723/32.png) [@njeffery123](https://discourse.slicer.org/u/njeffery123)\
**Post date:** [October 5, 2023, 6:55am UTC](https://discourse.slicer.org/t/monailabel-module-should-allow-user-to-select-different-volumes-in-current-scene/28522/24 "2023-10-05T06:55:30Z")

</div>

Thank you, I did try a loop but couldn’t get it to work because the --studies flag references a directory not a file. Will give the API approach a try

---

<div class="post-metadata">

**Author:** ![njeffery123](https://avatars.discourse-cdn.com/v4/letter/n/bc8723/32.png) [@njeffery123](https://discourse.slicer.org/u/njeffery123)\
**Post date:** [October 5, 2023, 7:32am UTC](https://discourse.slicer.org/t/monailabel-module-should-allow-user-to-select-different-volumes-in-current-scene/28522/25 "2023-10-05T07:32:44Z")

</div>

Just to a note to anyone else - the API approach works well. Start the server with the location of the files you want to batch infer, pop the server address in firefox and use “Run Batch Inference Task”. 100+ in a few minutes. Thanks @diazandr3s

---

<div class="post-metadata">

**Author:** ![diazandr3s](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/diazandr3s/32/9973_2.png) [@diazandr3s](https://discourse.slicer.org/u/diazandr3s)\
**Post date:** [October 6, 2023, 10:26pm UTC](https://discourse.slicer.org/t/monailabel-module-should-allow-user-to-select-different-volumes-in-current-scene/28522/26 "2023-10-06T22:26:35Z")

</div>

Thanks for reporting back, @njeffery123 🙂

[Previous page](https://discourse.slicer.org/t/monailabel-module-should-allow-user-to-select-different-volumes-in-current-scene/28522.md?page=1)
