How to incorporate the old extension (e.g. FuzzySegmentation) into 3D slicer?

Hi,

I tried to use Fuzzy C-mean (FCM) to do the segmentation but I did not found this module in the nightly-built version. However, I found an old one in version 3.6 but I do not how to incorporate it back to 3D slicer. Could you help me with that?

Best,
Tingting

Looks like that prototype never made it into slicer proper - the source code is still available and it should still work as a command line module (but it probably needs to ported to the latest ITK).

http://viewvc.slicer.org/viewvc.cgi/NAMICSandBox/trunk/BrainTissueClassification/?pathrev=6314

Hi Steve,

Thank you for your quick reply. What do you mean by “command line module”? Does that mean the python interactor? Could you give me some specific guidance on implementing “BrainTissueClassification”?

Best,
Tingting

Hi Tingting -

I mean it’s a C++ executable as described in the link below. These are simple non-interactive programs, typically for image processing using ITK. Since the fuzzy segmentation code is a bit old, it may need to be ported to accommodate possible changes to the ITK and CMake infrastructure. But probably the basic structure of the program is still good and can be made to work with current Slicer.

https://www.slicer.org/wiki/Documentation/Nightly/Developers/Modules#Command_Line_Interface_.28CLI.29

Hope that helps,
Steve

Hi Steve,

Thank you for your help.I used Extension Wizard to build a new extension and then copy the source code files from the link in the folder where I put the extension (Figure 1). I also check the source code, the code includes the lines below (Figure 2). When I tried to put the extension into the path in application setting, it failed. I am wondering how to do the compiling since Figure 2 shows that “After successfully compiling the Slicer module”? How to compile the new extension? Can I use git bash?I am also confused about Figure 3, should I install visual studio?

Best,
Tingting

Figure 1

Figure 2 https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Module

Figure 3 https://www.slicer.org/wiki/Documentation/Nightly/Developers/FAQ#How_to_build_an_extension_.3F

Hi Tingting -

It looks like you are on the right track - but yes, you definitely need a compiler and other prerequisites. Basically the same ones you need to build Slicer itself. Fair warning, compiling C++ code can be tricky and there is a learning curve.

https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions#Windows

To run your own compiled CLI module it is usually best to also compile your own slicer too (don’t try to run it against a binary install). Search the discourse archives and you’ll find advice for building Slicer. Once that’s done compiling the CLI is easier.

Also, I notice you are running a non-English version of windows - this is probably okay, but avoid non-ASCII characters in file paths.

One final note: because all the steps are required to use custom C++ code, we typically encourage people to work with python if they can. Stepping back even further, I’d encourage you to confirm that the fuzzy c-means approach is really critical before embarking on a potentially frustrating compilation task.

Hi Steve,

Thank you for your help. I gave a try today. It was frustrating because I am not familiar with the compilation in windows. The reason to use fuzzy c-means is to partition the ROI into several regions based on the enhanced signal (contrast enhanced MRI - pre-contrast MRI). Is there any alternative for segmentation that I can easily used in 3D slicer?

Best,
Tingting

With the Slicer Preview (Nightly) builds you can install python packages easily with pip_install (search for it in the discourse history) and this package might help:

https://pythonhosted.org/scikit-fuzzy/auto_examples/plot_cmeans.html

but otherwise, getting a good MR segmentation is a research topic in general. You’ll find bookshelves full of options, some of which may or may not work with your specific data.

Hope that helps,
Steve

Hi Steve,

Thank you so much.Thank you for your patience. They are helpful. I think I need to learn python.

Best,
Tingting