This page explains a way to use ilastik classification from FIJI/ImageJ, using the BIOP wrapper. Another parallel is the official ilastik fiji plugin (https://www.ilastik.org/documentation/fiji_export/plugin). The BIOP plugin has the advantage that it does not require conversion of files to hdf5.
You cannot do the training within FIJI, this needs to be done in ilastik. However, once you have a properly set ilastik project file (with ilp extension), you'll be able to perform ilastik classification from within FIJI/InageJ, in a convenient and easily scriptable/recordable manner.
= 1 - Setting up the FIJI Ilastik Bridge ( needs to be done once ) =
== 1.a. Install ilastik on your computer ==
Installer can be find on https://www.ilastik.org/
== 1.b. Enable BIOP fiji udate **dev** site: ==
In FIJI, click Help > Update > Add Update Site. In the new line created:
* put any name you like in the column Name (like BIOP-DEV)
* put `https://biop.epfl.ch/Fiji-Update-Dev/` in the URL column
* click Close then Apply changes, then restart FIJI
== 1.c. Make the connection between ilastik and Fiji ==
Fiji needs to know where the main ilastik executable file is located.
This needs to be done once. After FIJI will remember it (as long as you do not remove or change ilastik location on your HDD)
* In FIJI : click `Plugins > BIOP > Ilastik > Set Ilastik Location`
{F13336242, width=100%}
* Click Browse in front of `IlastikExecutable` (take care : do not choose Elastix, it's something different! ) and select the location of the ilastik exe file.
** Typically on windows: `C:\Program Files\ilastik-[version]\ilastik.exe`
** TODO : find typical ilastik location in Mac
* Press OK and then click `Window > Console`.
You should see:
```
[INFO] Ilastik was found ;-)
```
= 2 - Practical example : cell / nuclei pixel classification =
== 2.a. Make a pixel classifier with ilastik ==
Use ilastik as usual to make your classifier
(WARNING) Set the appropriate export settings
It's important to export the files in multipage tiff, please follow the settings below:
{F13330086, width=100%}
An example ilp file can be downloaded here:
== 2.b. Use Ilastik classification within FIJI ==
With a FIJI properly set up:
* Open the image you'd like to classify.
* Click `Plugins>BIOP>Ilastik>Ilastik Pixel Classification` (or use the search bar to directly find the `Ilastik Pixel Classification` command)
{F13336330, width=100%}
* Choose the right settings:
** Ilastik Project File : select the ilp file you'd like the use for the classification (pixel classifier with proper export settings)
** Classifier output :
*** Simple Segmentation : outputs a label image containing, for each pixel, the value of the associated class
*** Probabilities : returns the probability map for each class (one channel per class). Use float32 as pixel type for a nice output.
*** Pixel type :
**** uint8, for label image that contains less than 255 labels (typical for pixel classifier)
**** uint16, for label images that can contain more than 255 labels and up to 65535 (could be useful for object classification and big images)
**** float32, for probability maps
* Click OK
* Wait for the classifier to have finished its job. A result image should pop up.
(NOTE) If you see a white output window, try changing the LUT. For instance `Image>Lookup Tables>glasbey`
(NOTE) These commands are Macro Recordable
= 3 - More information about Ilastik FIJI Bridge =
== 3.a. What's currently supported in the ilastik fiji bridge ==
What is supported by the bridge:
* Image type supported:
** Single fluorescence channel
** RGB Images
* Ilastik taks:
** Pixel classification
** Multicut
* Export:
** Label image
** Probability map
What's known as currently unsupported:
* Image type supported:
** Multi fluorescence images
** Time Series ( to check )
* Ilastik taks:
** Object classification only
== 3.b. Source Code ==
Hosted on the BIOP GitHub account : https://github.com/BIOP/ijl-utilities-wrappers
== 4 - Troubleshooting ==
If you get an error like `java.lang.UnsupportedOperationException: Attempting to read or write from a io.scif.io.VirtualHandle. There is no source to operate on.` in the window console window:
* Check you select an appropriate image before starting the classifier (did you select the image before starting the classifier ? is it the correct bit depth ? correct number of channel ?)
* report to the biop in case the error cannot be solved (https://www.epfl.ch/research/facilities/ptbiop/staff/)
If you do not see any result image appearing after a very long time, maybe an error has occured. Check the error message in the console window. You can also restart the task and click verbose to get more information about the error.
This page explains a way to use ilastik classification from FIJI/ImageJ, using the BIOP FIJI ilastik Bridge. Another parallel is the official ilastik FIJI plugin (https://www.ilastik.org/documentation/fiji_export/plugin). The BIOP plugin has the advantage that it does not require conversion of files to hdf5.
NOTE: You cannot do the training within FIJI, this needs to be done in ilastik. However, once you have a properly set ilastik project file (with {nav .ilp} extension), you'll be able to perform ilastik classification from within FIJI/ImageJ, in a convenient and easily scriptable/recordable manner.
= 1 - Setting up the FIJI Ilastik Bridge ( needs to be done once ) =
== 1.a. Install ilastik on your computer ==
Installer can be find on https://www.ilastik.org/
== 1.b. Enable BIOP fiji udate **dev** site: ==
In FIJI, click {nav icon=cog value= Help > Update > Add Update Site}. In the new line created:
* put any name you like in the column Name (like `BIOP-DEV`)
* put `https://biop.epfl.ch/Fiji-Update-Dev/` in the URL column
* click {nav Close} then {nav Apply changes}, then restart FIJI
== 1.c. Make the connection between ilastik and Fiji ==
Fiji needs to know where the main ilastik executable file is located.
This needs to be done **once**. After, FIJI will remember it (as long as you do not remove or change ilastik location on your HDD)
* In FIJI : click {nav Plugins > BIOP > Ilastik > Set Ilastik Location}
{F13336242, width=100%}
* Click Browse in front of `IlastikExecutable` (take care : do not choose **Elastix**, it's something different! ) and select the location of the ilastik.exe file.
** Typically on windows: `C:\Program Files\ilastik-[version]\ilastik.exe`
** TODO : find typical ilastik location in Mac
* Press OK and then click `Window > Console`.
You should see:
```
[INFO] Ilastik was found ;-)
```
= 2 - Practical example : cell / nuclei pixel classification =
== 2.a. Make a pixel classifier with ilastik ==
Use ilastik as usual to make your classifier.
WARNING: Set the appropriate export settings
It's important to export the files in `multipage tiff`, please follow the settings below:
{F13330086, width=100%}
== 2.b. Use Ilastik classification within FIJI ==
With a FIJI properly set up:
* Open the image you'd like to classify.
* Click {nav Plugins>BIOP>Ilastik>Ilastik Pixel Classification} (or use the search bar to directly find the `Ilastik Pixel Classification` command).
{F13336330, width=100%}
* Choose the right settings:
** **Ilastik Project File** : select the ilp file you'd like the use for the classification (pixel classifier with proper export settings).
** **Classifier output** :
*** **Simple Segmentation** : outputs a label image containing, for each pixel, the value of the associated class.
*** **Probabilities** : returns the probability map for each class (one channel per class). Use float32 as pixel type for a nice output.
*** **Pixel type** :
**** **uint8**, for label image that contains less than 255 labels (typical for pixel classifier).
**** **uint16**, for label images that can contain more than 255 labels and up to 65535 (could be useful for object classification and big images).
**** **float32**, for probability maps.
* Click OK
* Wait for the classifier to have finished its job. A result image should pop up.
NOTE: If you see a white output window, try changing the LUT. For instance `Image>Lookup Tables>glasbey`
(NOTE) These commands are Macro Recordable!
= 3 - More information about Ilastik FIJI Bridge =
== 3.a. What's currently supported in the ilastik FIJI Bridge ==
What is supported by the bridge:
* Image type supported:
** Single fluorescence channel
** RGB Images
* Ilastik taks:
** Pixel classification
** Multicut
* Export:
** Label image
** Probability map
What's known as currently unsupported:
* Image type supported:
** Multi fluorescence images
** Time Series ( to check )
* Ilastik taks:
** Object classification only
== 3.b. Source Code ==
Hosted on the BIOP GitHub account : https://github.com/BIOP/ijl-utilities-wrappers
== 4 - Troubleshooting ==
If you get an error like `java.lang.UnsupportedOperationException: Attempting to read or write from a io.scif.io.VirtualHandle`, this probably means that ilastik has failed for whatever reason
* Make sure that you select an appropriate image before starting the classifier:
** Make sure that the original image is selected, not the results from a previous classification
** Make sure it is the correct bit depth and correct number of channels)
(ERROR) Feel free to report to the BIOP in case the error cannot be solved (https://biop.epfl.ch)
If you do not see any result images appearing after a very long time, maybe an error has occured. Check the error message in the console window. You can also restart the task and click verbose to get more information about the error.