Mamba3d and numpy

55 views
Skip to first unread message

mohamma...@gmail.com

unread,
Aug 16, 2014, 7:04:16 AM8/16/14
to mamba...@googlegroups.com
Hi
Is it possible to convert a 3d numpy array to a a mamba3D image?

Nicolas Beucher

unread,
Aug 17, 2014, 3:17:48 PM8/17/14
to mamba...@googlegroups.com, mohamma...@gmail.com
Hi,

There is no reason for it not to be possible.
Here is an example of inyterfacing numpy and mamba for 2D images :

For 3D images you will have to proceed image by image by loading your 3D array by slices.

Nicolas.

Mohammad Havaei

unread,
Aug 19, 2014, 7:47:13 PM8/19/14
to Nicolas Beucher, mamba...@googlegroups.com
Hi 
Thanks for your response. The thing is that i like to use mamba3d.segment3d.label3d function on a 3d numpy array. But I dont understand how to do that. 
If I load the array slice by slice, how can I combine them together to be a 3D tensor so I can apply label3d on it?

Thank you very much
Mohammad

Serge Beucher

unread,
Aug 21, 2014, 3:46:38 AM8/21/14
to mamba...@googlegroups.com, Nicolas Beucher
Hi,

I don't clearly understand your problem. If you want to use the Mamba 3D segmentation tools (watershed transformation), your 3D image must be stored in a Mamba image created with image3DMb. This 3D image is basically a pile of 2D Mamba images. Suppose that your 3D Mamba image is named im3D. Then, you need to extract each slice i of your numpy array (I am not familiar with numpy but I know that this slicing tool exists) and store it in the corresponding slice im3D[i] of the Mamba 3D image. To achieve this, have a look on the example already cited in Nicolas' answer.
Be aware also that the horizontal size of the Mamba image is always a multiple of 64. So, if your array has a different horizontal size, it will be padded with 0. This may induce problems (edge effects) if you don't take care of this.

Once, you have a 3D Mamba image, you can apply on it the 3D watershed transform (valuedWatershed3D). The basinSegment3D or watershedSegment3D operators can not be used directly on the initial image, as they require a labelled flooding source image (generated by label3D). Here again, have a look on the documentation given in the Mamba examples:

http://www.mamba-image.org/examples/exampleM3.py
http://www.mamba-image.org/examples/exampleA11.py
http://www.mamba-image.org/examples/exampleM17.py

and also on other papers explaining how to use the watershed transformation which can be found on my web page:

http://cmm.ensmp.fr/~beucher/publi.html
http://cmm.ensmp.fr/~beucher/Mamba_documentation.html


Sincerely,

Serge






--
You received this message because you are subscribed to the Google Groups "Mamba Image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mamba-image...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages