Difference between revisions of "KymographBuilder : Yet Another Kymograph Fiji plugin"

(Add link to Multi_Kymograph)
Line 30: Line 30:
  
 
[[File:Kymograph_Construction.png|center|thumb|600px|]]
 
[[File:Kymograph_Construction.png|center|thumb|600px|]]
 +
 +
== Scripting ==
 +
 +
You can script the plugin. Here is an example :
 +
 +
<source lang="python">
 +
# @Context context
 +
# @Dataset dataset
 +
# @ImageJ ij
 +
# @LogService log
 +
 +
# This script exemplifies how to instruct KymographBuilder to
 +
# process all the line ROIs present in the ROI Manager. For more
 +
# details see http://imagej.net/KymographBuilder
 +
import ij.plugin.frame.RoiManager as RM
 +
import fiji.plugin.kymographbuilder.KymographFactory as KFactory
 +
 +
 +
def validDataset(dataset):
 +
    """Assess if dataset has suitable dimensions"""
 +
    from net.imagej.axis import Axes
 +
    z = dataset.dimension(dataset.dimensionIndex(Axes.Z))
 +
    t = dataset.dimension(dataset.dimensionIndex(Axes.TIME))
 +
    return z * t > 1
 +
 +
 +
rm = RM.getInstance()
 +
counter = 0
 +
if validDataset(dataset) and rm and rm.getCount():
 +
    for roi in rm.getRoisAsArray():
 +
        if roi.isLine():
 +
            kfactory = KFactory(context, dataset, roi)
 +
            kfactory.build()
 +
            counter += 1
 +
            title = "Kymograph" + str(counter).zfill(3) + "_" + roi.getName()
 +
            ij.ui().show(title, kfactory.getKymograph())
 +
    log.info("MultiKymographBuilder Finished. " + str(counter) + " ROIs processed")
 +
else:
 +
    log.error("Either the ROI Manager is empty or " + dataset.getName() +" has invalid dimensions")
 +
</source>
 +
 +
The script can be found in the source code : https://github.com/fiji/KymographBuilder/blob/master/src/main/resources/script_templates/Examples/MultiKymographBuilder.py
  
 
== Related links ==
 
== Related links ==

Revision as of 13:32, 27 June 2016

KymographBuilder (Fiji)
Author Hadrien Mary
Maintainer Hadrien Mary
Source on GitHub
Initial release 24/04/2016
Development status v1.2.2, stable


Presentation

KymographBuilder is Yet Another Kymograph Fiji plugin.

Features are :

  • Build kymograph from a straight or segmented line (a polyline).
  • Build kymograph for images with multiple channels.
  • Take into account the width of the line using maximum projection along its thickness.
  • Built from scratch and use the ImageJ2 Ecosystem.
  • Fast and easy to use.

How to use :

  • Draw a line: it can be a polyline and you can also set the thickness that will be taken into account by the plugin.
  • Launch KymographBuilder : Plugins › Kymograph › KymographBuilder
  • You're done.
Kymograph Construction.png

Scripting

You can script the plugin. Here is an example :

# @Context context
# @Dataset dataset
# @ImageJ ij
# @LogService log

# This script exemplifies how to instruct KymographBuilder to
# process all the line ROIs present in the ROI Manager. For more
# details see http://imagej.net/KymographBuilder
import ij.plugin.frame.RoiManager as RM
import fiji.plugin.kymographbuilder.KymographFactory as KFactory


def validDataset(dataset):
    """Assess if dataset has suitable dimensions"""
    from net.imagej.axis import Axes
    z = dataset.dimension(dataset.dimensionIndex(Axes.Z))
    t = dataset.dimension(dataset.dimensionIndex(Axes.TIME))
    return z * t > 1


rm = RM.getInstance()
counter = 0
if validDataset(dataset) and rm and rm.getCount():
    for roi in rm.getRoisAsArray():
        if roi.isLine():
            kfactory = KFactory(context, dataset, roi)
            kfactory.build()
            counter += 1
            title = "Kymograph" + str(counter).zfill(3) + "_" + roi.getName()
            ij.ui().show(title, kfactory.getKymograph())
    log.info("MultiKymographBuilder Finished. " + str(counter) + " ROIs processed")
else:
    log.error("Either the ROI Manager is empty or " + dataset.getName() +" has invalid dimensions")

The script can be found in the source code : https://github.com/fiji/KymographBuilder/blob/master/src/main/resources/script_templates/Examples/MultiKymographBuilder.py

Related links

Authors

KymographBuilder has been created by Hadrien Mary.

This work started in 2016 at the Gary Brouhard laboratory (http://brouhardlab.mcgill.ca) at McGill University.