Brain_extraction

Hello, Thanks for your great software.

I have a 3D MRI image of the macaque’s brain and a brain mask that I made manually, then I left this mask with your software (ImFusion Labels), after the smoothing I export the mask in NIFTI form (. nii.gz), but when I apply my brain_extraction function, the result is not good, wearing when I run this function with the original mask (without smoothing) works fine.

suddenly I think that the mask that I export with ImFusion Labels does not keep the properties of the original mask !!

how can I export a smoothing mask without changing the properties (x, y, z directions …) ?

Thank you.

Abdelhadi.

Hi Abdelhadi,
I am not sure to really understand your workflow.
Can you share the two files (the one that works with your function and the one that doesn’t), and how you generated them? (is the only difference that you applied a smoothing in the Refine tab between the two exports?)


Uploading: transformations .png…

Hello Raphaël.

I have a mask generated by ITKsnap, I applied a smoothing to this mask with ImFusion, after I exported it, but I noticed that the properties have changed.

0-Labels it’s a mask Smooth.

Hi,
Is the problem you’re having with the transformations property? The only difference I see is that the one created by ImFusion Labels has two transformations, in two different coordinates system. The first one, ‘scanner-based anatomical coordinates’ is the same value in both cases.
One other difference is in the disk_data_type. We always use U8 within ImFusion, which allows for 255 different label values, which is more than enough.

Can you also tell us what software you’re using to inspect the .nii properties?


Uploading: result_mask_after_smooth.png…


Uploading: result_mask_befor_smooth.png…

I used ITKsnap to inspect the .nii !

Ok, just looking at the properties of the two files it’s not clear why the image would be flipped.
If not confidential, can you upload the files somewhere? Or send them by email to perret@imfusion.com

Can you also detail the steps of how the two segmentations were created? Your initial post is not clear to us. The mask is initially created in ITK-snap, imported into ImFusion Labels, exported and then imported again to ITK-snap?

Yes, first the mask is initially created in ITK-snap, then imoprted into ImFusion, I smooth this mask on ImFusion, after that I exported.

the probleme is : when I lance my fonction “Brain_extraction” (python), with the original mask (mask created in ITK-snap), the result it’s good (capture1), but when I export the same mask after smoothing on ImFusion and I lance the same fonction “Brain_extraction” the result it’s not good.

I dont know why the mask (ImFusion) be flipped, how can I export the mask with the same proprities of the original mask ?

Capture1


Capture 2

Hi,
The reason why this is happening is that our nifti exporter only supports RPI coordinate system, whereas the original data uses RPS. So when you try to load the segmentation in ITK-snap, you see a warning that the segmentation does not have the same orientation as the data, and that the orientation of the segmentation will be ignored.
If you open it in other software like Slicer, you will see that the data and the mask are loaded with the same orientation.
One way to work around this issue is to make sure that the data and the segmentation have the same orientation. When exporting in ImFusion Labels, both the dataset and the segmentation are saved as files. So instead of loading the original file of the macaque scan, you should load the 0.nii.gz together with 0-labels.nii.gz. The content should be the exact same as the original scan.

You can also try to find other software that let you change the coordinate system of a nifti file, to ensure that both the scan and the segmentation have the same. I do not have any to recommend, however.

Okay it’s clair now, thank you so much for your help.