Giter Site home page Giter Site logo

ilastik / hytra Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 7.0 4.22 MB

Python module for multi HYpotheses TRAcking

Home Page: https://github.com/ilastik/hytra

License: MIT License

Python 95.49% MATLAB 0.15% Shell 1.27% Jupyter Notebook 3.08%
ilastik tracking

hytra's Introduction

ilastik logo

ilastik

The interactive learning and segmentation toolkit

CircleCI AppVeyor Codecov Image.sc forum Code style: black

Leverage machine learning algorithms to easily segment, classify, track and count your cells or other experimental data. Most operations are interactive, even on large datasets: you just draw the labels and immediately see the result. No machine learning expertise required.

Screenshot

See ilastik.org for more info.


Installation

Binary installation

Go to the download page, get the latest non-beta version for your operating system, and follow the installation instructions. If you are new to ilastik, we suggest to start from the pixel classification workflow. If you don't have a dataset to work with, download one of the example projects to get started.

Conda installation (experimental)

ilastik is also available as a conda package on our ilastik-forge conda channel. We recommend using mamba instead of conda, for faster installation:

mamba create -n ilastik --override-channels -c pytorch -c ilastik-forge -c conda-forge ilastik

# activate ilastik environment and start ilastik
conda activate ilastik
ilastik

Python compatibility notes

Versions of ilastik until 1.4.1b2 are based on, and only compatible with Python 3.7 Starting from ilastik 1.4.1b3 ilastik environments can be created with Python versions 3.7 to 3.9. Limitations when going with Python 3.7: please use a version of tifffile >2020.9.22,<=2021.11.2 (see also note in environment-dev.yml).

Usage

ilastik is a collection of workflows, designed to guide you through a sequence of steps. You can select a new workflow, or load an existing one, via the startup screen. The specific steps vary between workflows, but there are some common elements like data selection and data navigation. See more details on the documentation page.

Support

If you have a question, please create a topic on the image.sc forum. Before doing that, search for similar topics first: maybe your issue has been already solved! You can also open an issue here on GitHub if you have a technical bug report and/or feature suggestion.

Contributing

We always welcome good pull requests! If you just want to suggest a documentation edit, you can do this directly here, on GitHub. For more complex changes, see CONTRIBUTING.md for details.

License

GPL

hytra's People

Contributors

chaubold avatar dstoe avatar hanslovsky avatar ilastikdev avatar jaimeivancervantes avatar k-dominik avatar letip avatar m-novikov avatar martinsch avatar sabrina85 avatar sreith avatar steffen-wolf avatar stuarteberg avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hytra's Issues

Tracklets length one

Tracklets of length one (two nodes connected with only one edge and no other incoming and outgoing edges) get compressed into... nothing and lead to no solution there.

json -> ctc result export

Error on Rapoport: the following assertion is failing.
if 'parent' in hypothesesGraph._graph.node[n]:
assert(trackId not in trackParents)

Default Features

need to be accessed via opObjectExtraction.default_features_key

(ilastik-devel) jales@seagul:~/software/miniconda/envs/ilastik-devel/src/hytra$ git diff 2a6b060e6ec4f06c342f207ca5253331d5a661df
diff --git a/hytra/multitrack_ilastik10 b/hytra/multitrack_ilastik10
index 3ec87ef..9f17f8c 100755
--- a/hytra/multitrack_ilastik10
+++ b/hytra/multitrack_ilastik10
@@ -21,6 +21,7 @@ from trackingfeatures import extract_features_and_compute_score, get_feature_vec
 from hytra.util.progressbar import ProgressBar
 from empryonic import io
 from multiprocessing import Pool
+from ilastik.applets.objectExtraction.opObjectExtraction import default_features_key
 
 def swirl_motion_func_creator(velocityWeight):
     def swirl_motion_func(traxelA, traxelB, traxelC, traxelD):
@@ -161,7 +162,7 @@ copied but linked to the original files to improve execution speed and storage r
     consopts.add_option('--divPath', dest='div_prob_path', type='string', default='/DivisionDetection/Probabilities/0/',
                         help='internal hdf5 path to division probabilities [default=%default]')
     consopts.add_option('--featsPath', dest='feats_path', type='string',
-                        default='/ObjectExtraction/RegionFeatures/0/[[%d], [%d]]/Default features/%s',
+                        default='/ObjectExtraction/RegionFeatures/0/[[%d], [%d]]/'+default_features_key+'/%s',
                         help='internal hdf5 path to object features [default=%default]')
     consopts.add_option('--translationPath', dest='trans_vector_path', type='str',
                         default='OpticalTranslation/TranslationVectors/0/data',
diff --git a/scripts/hypotheses_graph_to_json.py b/scripts/hypotheses_graph_to_json.py
index 0fd67cd..194c2df 100644
--- a/scripts/hypotheses_graph_to_json.py
+++ b/scripts/hypotheses_graph_to_json.py
@@ -13,6 +13,7 @@ import hytra.core.hypothesesgraph as hypothesesgraph
 import hytra.core.ilastikhypothesesgraph as ilastikhypothesesgraph
 from hytra.pluginsystem.plugin_manager import TrackingPluginManager
 import hytra.core.jsongraph
+from ilastik.applets.objectExtraction.opObjectExtraction import default_features_key
 
 def getConfigAndCommandLineArguments():
     parser = configargparse.ArgumentParser(description=""" 
@@ -91,7 +92,7 @@ def getConfigAndCommandLineArguments():
     parser.add_argument('--division-classifier-file', dest='div_file', type=str, default=None,
                         help='Filename of the HDF file containing the division classifier. If None, will be taken from ILP')
     parser.add_argument('--featsPath', dest='feats_path', type=str,
-                        default='/TrackingFeatureExtraction/RegionFeaturesVigra/0000/[[%d], [%d]]/Default features/%s',
+                        default='/TrackingFeatureExtraction/RegionFeaturesVigra/0000/[[%d], [%d]]/'+default_features_key+'/%s',
                         help='internal hdf5 path to object features')
     parser.add_argument('--transition-classifier-file', dest='transition_classifier_filename', type=str,
                         default=None)
diff --git a/scripts/plot_probability_distribs.py b/scripts/plot_probability_distribs.py
index f6a7038..56f1601 100644
--- a/scripts/plot_probability_distribs.py
+++ b/scripts/plot_probability_distribs.py
@@ -17,6 +17,7 @@ import vigra
 import copy
 import pgmlink as track
 from empryonic import io
+from ilastik.applets.objectExtraction.opObjectExtraction import default_features_key
 
 def getConfigAndCommandLineArguments():
 
@@ -96,7 +97,7 @@ copied but linked to the original files to improve execution speed and storage r
     consopts.add_option('--divPath', dest='div_prob_path', type='string', default='/DivisionDetection/Probabilities/0/',
                         help='internal hdf5 path to division probabilities [default=%default]')
     consopts.add_option('--featsPath', dest='feats_path', type='string',
-                        default='/ObjectExtraction/RegionFeatures/0/[[%d], [%d]]/Default features/%s',
+                        default='/ObjectExtraction/RegionFeatures/0/[[%d], [%d]]/'+default_features_key+'/%s',
                         help='internal hdf5 path to object features [default=%default]')
     consopts.add_option('--translationPath', dest='trans_vector_path', type='str',
                         default='OpticalTranslation/TranslationVectors/0/data',

merger resolving: KeyError 'newIds'

ERROR 2017-03-20 14:25:51,179 log_exception 31444 140602277164800 Traceback (most recent call last):
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/dataExport/dataExportGui.py", line 386, in exportSlots
    self.parentApplet.prepare_lane_for_export(lane_index)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/workflows/tracking/structured/structuredTrackingWorkflow.py", line 372, in prepare_lane_for_export
    withBatchProcessing = True
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/tracking/conservation/opConservationTracking.py", line 452, in track
    resolvedMergersDict = self._resolveMergers(hypothesesGraph, model)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/tracking/conservation/opConservationTracking.py", line 324, in _resolveMergers
    resolvedMergersDict = mergerResolver.run()
  File "/home/jales/devel/src/hytra/hytra/core/ilastikmergerresolver.py", line 100, in run
    mergerLinkFilter)
  File "/home/jales/devel/src/hytra/hytra/core/mergerresolver.py", line 286, in _refineModel
    newIds = self.unresolvedGraph.node[node]['newIds']
KeyError: u'newIds'


no division features

of a parent object of a division
(children's life time is 1 time frame - if this is increased to 2, code works)

(ilastik-devel) jales@seagul:~/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik$ ./ilastik.py
Starting ilastik from "/home/jales/software/miniconda/envs/ilastik-devel".
[====================] 100%
[====================] 100%
[====================] 100%
************************
Settings are:
	StatesShareWeights: true
	AllowPartialMergerAppearance: false
	AllowLengthOneTracks: false
	RequireSeparateChildrenOfDivision: true
	NonNegativeWeightsOnly: false
	OptimizerEpGap: 0.005
	OptimizerVerbose: true
	OptimizerNumThreads: 1
************************
	contains 6 segmentation hypotheses
	contains 8 linking hypotheses
Initializing opengm model...
Model has 60 indicator variables
	contains 8 linking annotations
	contains 6 detection annotations
	contains 2 division annotations
ERROR 2016-12-19 13:02:44,231 excepthooks 429 139810788579136 Unhandled exception in thread: 'MainThread'
ERROR 2016-12-19 13:02:44,231 excepthooks 429 139810788579136 Traceback (most recent call last):
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/tracking/structured/structuredTrackingGui.py", line 366, in _onRunStructuredLearningButtonPressed
    withBatchProcessing)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/tracking/structured/opStructuredTracking.py", line 340, in _runStructuredLearning
    mht.trainWithWeightInitialization(model,gt, initialWeights)
RuntimeError: Trying to set division of 12 active but the variable had no division features!

object 12 (in question) does have division features:

 {'appearanceFeatures': [[0.0], [1.0]],
                             'disappearanceFeatures': [[0.0], [1.0]],
                             'divisionFeatures': [[2.0402208652063365],
                                                  [0.1392620618526208]],
                             'features': [[1.2039727645895069],
                                          [0.35667496096863105]],
                             'id': 12,
                             'timestep': [5, 5]}

trackingGraph.weightsListToDict returns only 4 weights

no matter what the value of withDivisions is

trackingGraph.weightsListToDict([transitionWeight, detectionWeight, divisionWeight, appearanceWeight, disappearanceWeight])

withDivisions True
INFO ilastik.applets.tracking.conservation.opConservationTracking: generating traxels
INFO ilastik.applets.tracking.conservation.opConservationTracking: fetching region features and division probabilities
INFO ilastik.applets.objectClassification.opObjectClassification: training on matrix of shape (1, 33)
INFO lazyflow.classifiers.parallelVigraRfLazyflowClassifier: Training took, 0.000745 seconds
INFO lazyflow.classifiers.parallelVigraRfLazyflowClassifier: Training complete. Average OOB: nan
INFO ilastik.applets.objectClassification.opObjectClassification: training finished, average out-of-bag error: nan
INFO ilastik.applets.objectClassification.opObjectClassification: training on matrix of shape (3, 31)
INFO lazyflow.classifiers.parallelVigraRfLazyflowClassifier: Training took, 0.00109 seconds
INFO lazyflow.classifiers.parallelVigraRfLazyflowClassifier: Training complete. Average OOB: 1.0
INFO ilastik.applets.objectClassification.opObjectClassification: training finished, average out-of-bag error: 1.0
INFO ilastik.applets.tracking.conservation.opConservationTracking: filling traxelstore
[====================] 100%
[====================] 100%
INFO ilastik.applets.tracking.structured.opStructuredTracking: Structured Learning: Adding Training Annotations to Hypotheses Graph
INFO ilastik.applets.tracking.structured.opStructuredTracking: max nearest neighbors=
[====================] 100%
inintialWeights {'weights': [0.01, 0.6, 0.3, 0.2]}
************************
Settings are:
	StatesShareWeights: true
	AllowPartialMergerAppearance: false
	AllowLengthOneTracks: false
	RequireSeparateChildrenOfDivision: true
	NonNegativeWeightsOnly: false
	OptimizerEpGap: 0.005
	OptimizerVerbose: true
	OptimizerNumThreads: 1
************************
	contains 0 segmentation hypotheses
	contains 0 linking hypotheses
Provided length of vector with initial weights has wrong length!
ERROR 2016-12-09 13:52:41,627 log_exception 6322 140393793619776 Traceback (most recent call last):
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/shell/projectManager.py", line 443, in _loadProject
    self.workflow.onProjectLoaded( self )
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/workflows/tracking/structured/structuredTrackingWorkflow.py", line 438, in onProjectLoaded
    self.batchProcessingApplet.run_export_from_parsed_args(self._batch_input_args)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/batchProcessing/batchProcessingApplet.py", line 60, in run_export_from_parsed_args
    return self.run_export(role_path_dict, parsed_args.input_axes)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/batchProcessing/batchProcessingApplet.py", line 121, in run_export
    export_to_array=export_to_array )
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/batchProcessing/batchProcessingApplet.py", line 223, in _run_export_with_empty_batch_lane
    self.dataExportApplet.prepare_lane_for_export(batch_lane_index)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/workflows/tracking/structured/structuredTrackingWorkflow.py", line 342, in prepare_lane_for_export
    withBatchProcessing=True)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/tracking/structured/opStructuredTracking.py", line 333, in _runStructuredLearning
    mht.trainWithWeightInitialization(model,gt, initialWeights)
RuntimeError: Provided length of vector with initial weights has wrong length!

ERROR 2016-12-09 13:52:41,628 log_exception 6322 140393793619776 Project could not be loaded due to the exception shown above.
Aborting Project Open Action
E
======================================================================
ERROR: testStructuredLearningTrackingHytraWithMergers.TestStructuredLearningTrackingHeadless.testStructuredLearningTrackingHeadless
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jales/software/miniconda/envs/ilastik-devel/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/lazyflow/lazyflow/utility/timer.py", line 142, in wrapper
    return func(*args, **kwargs)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/tests/test_applets/structuredLearningTracking/testStructuredLearningTrackingHytraWithMergers.py", line 114, in testStructuredLearningTrackingHeadless
    self.ilastik_startup.main()
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/../ilastik.py", line 108, in main
    ilastik_main.main(parsed_args, workflow_cmdline_args)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik_main.py", line 102, in main
    f(shell)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik_main.py", line 317, in loadProject
    shell.openProjectFile(path, parsed_args.readonly)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/shell/headless/headlessShell.py", line 116, in openProjectFile
    self.projectManager._loadProject(hdf5File, projectFilePath, readOnly)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/lazyflow/lazyflow/utility/timer.py", line 142, in wrapper
    return func(*args, **kwargs)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/shell/projectManager.py", line 443, in _loadProject
    self.workflow.onProjectLoaded( self )
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/workflows/tracking/structured/structuredTrackingWorkflow.py", line 438, in onProjectLoaded
    self.batchProcessingApplet.run_export_from_parsed_args(self._batch_input_args)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/batchProcessing/batchProcessingApplet.py", line 60, in run_export_from_parsed_args
    return self.run_export(role_path_dict, parsed_args.input_axes)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/batchProcessing/batchProcessingApplet.py", line 121, in run_export
    export_to_array=export_to_array )
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/batchProcessing/batchProcessingApplet.py", line 223, in _run_export_with_empty_batch_lane
    self.dataExportApplet.prepare_lane_for_export(batch_lane_index)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/workflows/tracking/structured/structuredTrackingWorkflow.py", line 342, in prepare_lane_for_export
    withBatchProcessing=True)
  File "/home/jales/software/miniconda/envs/ilastik-devel/ilastik-meta/ilastik/ilastik/applets/tracking/structured/opStructuredTracking.py", line 333, in _runStructuredLearning
    mht.trainWithWeightInitialization(model,gt, initialWeights)
RuntimeError: Provided length of vector with initial weights has wrong length!

Prepare for Python3

Using the 2to3 tool this should be rather easy, but how do we support both, Python 2 and 3? We could use six to manage some things, and import future...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.