# Novice Guidance for Using MONAI Label to Create an Automatic Segmentation App

**URL:** https://discourse.slicer.org/t/novice-guidance-for-using-monai-label-to-create-an-automatic-segmentation-app/27504
**Category:** Support
**Tags:** segmentation, mri, python, macos, monailabel
**Created:** [January 27, 2023, 3:35pm UTC](https://discourse.slicer.org/t/novice-guidance-for-using-monai-label-to-create-an-automatic-segmentation-app/27504 "2023-01-27T15:35:55Z")
**Posts on this page:** 1
**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: [November 21, 2023, 5:49am UTC](https://discourse.slicer.org/t/novice-guidance-for-using-monai-label-to-create-an-automatic-segmentation-app/27504/21 "2023-11-21T05:49:32Z")

</div>

> [@Pragnesh\_Patel](#):
>
> NameError Traceback (most recent call last)  
> in \<cell line: 16\>()  
> 30 ).to(device)  
> 31  
> —\> 32 data\_in = prepare(data\_dir, cache=True)  
> 33  
> 34 #loss\_function = DiceCELoss(to\_onehot\_y=True, sigmoid=True, squared\_pred=True, ce\_weight=calculate\_weights(1792651250,2510860).to(device))
> 
> in prepare(in\_dir, pixdim, a\_min, a\_max, spatial\_size, cache)  
> 79 LoadImaged(keys=[“vol”, “seg”]),  
> 80 # EnsureChannelFirst(),  
> —\> 81 AddChanneld(keys=[“vol”, “seg”]),  
> 82 Spacingd(keys=[“vol”, “seg”], pixdim=pixdim, mode=(“bilinear”, “nearest”)),  
> 83 Orientationd(keys=[“vol”, “seg”], axcodes=“RAS”),

I think this is code from the MONAI framework and you are in the wrong forum here. Sorry we can not help with such limited information.

[Previous page](https://discourse.slicer.org/t/novice-guidance-for-using-monai-label-to-create-an-automatic-segmentation-app/27504.md?page=1)
