Dear Sir,

I have 100 slice image dicom. I did the lesion segmentation using MATLAB.

Then, how to import my images with my segmentation in 3D Slicer?

Dear Sir,

I have 100 slice image dicom. I did the lesion segmentation using MATLAB.

Then, how to import my images with my segmentation in 3D Slicer?

I would recommend to save the segmentation from Matlab into a nrrd file. Use the `.seg.nrrd`

file extension to get the file loaded as a segmentation by default. You can use nrrdwrite to create a segmentation file from a Matlab array. Make sure to use the same image geometry (`ijkToLpsTransform`

) as the input nrrd file that you segmented.

What was the reason for implementing your lesion segmentation method in Matlab? Python has very significant advantages, such as many more available packages, easier to distribute to end users (no licensing hassles), and being able to run your scripts directly in Slicer (no need to use Slicer MatlabBridge or manually save+process+load data).

I used the method gradient different weight.

There is no in 3D slicer.

What is the exact name of the function that you used? Does it calculate the image gradient magnitude? That (and hundreds of similar functions) are available in VTK, ITK, scipy, and in many other pip-installable Python packages.

Are you using this example: Calculate weights for image pixels based on image gradient - MATLAB gradientweight ? Image segmentation using Fast marching is available in Slicer, for example in the `Fast marching`

effect in Segment Editor (provided by `SegmentEditorExtraEffects`

extension). You can use `Grow from seeds`

effect for automatic segmentation, too (you generate scribbles based on a user click); or Local threshold effect (that uses `Grow from seeds`

or `Watershed`

or simple grayscale connectivity to segment an object by a single click).

yup. I used the function graydiffweight Calculate weights for image pixels based on grayscale intensity difference - MATLAB graydiffweight.

actually, I have modified this function to get one equation that is used in graydiffweight algorithm. Then, I will get the high accuracy volume segmentation for SPECT images.

I have tried to use many methods in 3D Slicer, but it’s not accurate to compare to what I was done.

Back to the issue is, when I have done segmentation SPECT images using Matlab, then I want to import to 3D Slicer to analyze the radiomics parameter using radiomics extension in 3D Slicer.

It seems that `graydiffweight`

can compute the difference of array values and a constant value. You can reproduce what the function does with 1-2 `numpy`

function calls.

Probably you have tried some high-level modules in Slicer, which expose some commonly needed features, but they may not be exactly what you need. You have access to all functions of all Python packages in Slicer, so if you need any custom computation then it should be about as easy to implement that as in Matlab.

The enormous advantage of Python is that if you implement something then you can make it easily available to all Python users (via PyPI) and to clinical users (for example, as a Slicer extension).

See my answer above - you can use `nrrdread.m`

and `nrrdwrite.m`

to read/write image data (SPECT image, segmentation, etc.) while preserving essential image metadata.

Thank you sir. My problem solve.

But I still don’t know how to apply MatlabBridge ??

Can give me some video?

Documentation and examples of the MatlabBridge are available here: Documentation/Nightly/Extensions/MatlabBridge - Slicer Wiki It should be sufficient for you to get started with it.