GithubHelp home page GithubHelp logo

csatizoltan / grainsegmentation Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 3.0 2.26 MB

Identification of individual grains in microscopic images

License: GNU General Public License v3.0

Python 100.00%
image-segmentation image-processing imagepy-plugins python microscopy-images

grainsegmentation's People

Contributors

csatizoltan avatar gitter-badger avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

grainsegmentation's Issues

Dropdown menu to select from general options

ImagePy supports dropdown menus. I can use them to select from a set of user-defined options. This is a generalization of the img variable used in the view variable in the RagThreshold class, see also #7 (comment).
A particular use case: choose among several label images saved in the data attribute of the ImagePlus object.

Passing data among plugins

Data exchange among multiple plugins can be carried out in ImagePy in different ways. As an example, see this. Those solutions are better than the currently used module-level global object.
Also see the related issue #7.

Type checking

Perform type checking for the inputs of all the methods of class GrainSegmentation. Consider using type annotations. For numpy, see nptyping.

Create install file

The installation instructions are pure shell commands. Put them into a shell script.

Implement error checking

Overriding the the load or the check method of the Filter or Simple classes is a good way to implement error checking. For an example, see this.

ImagePy plugin using an existing class

Reproducing the menu structure for an ImagePy plugin works successfully if I directly put the implementation to the run method. Actually, in the existing projects I found (seaice, skimg, ITK, IBook), the implementation of an algorithm is always in the same file (i.e. in the plugin file: xxx_plgs.py) as the classes containing the run method. E.g. the showice function is in result_plgs.py, just as the run methods of the classes inheriting from the Simple class.

In my case, the algorithms can be found in the GrainSegmentation class in grain_segmentation.py. So what I want is:

  • Create an ImagePy plugin segmentation_plgs.py, which contains classes such as OpenImage, Filter, etc. The OpenImage class would call the constructor of the class GrainSegmentation, while the Filter class would call the method filter_image from GrainSegmentation.
  • The output of one method (e.g. filter_image) should be the input for another method (e.g. initial_segmentation). My problem is that the run method does not have output arguments. So how can I pass the output to the run method of another class?

Organizing the project

My project will consist of multiple functions. I read in the demo document how to organize them. What I want is the following:

  • the directory structure corresponds to what is expected (or what is a good practice) in ImagePy
  • my Python functions and modules are completely separated from ImagePy, i.e. they can be usable without ImagePy being installed

I have the following directory structure in mind.

README.md
LICENSE
.gitignore
requirements.txt (so that ImagePy handles the dependencies)
data
 |--- samples (sample images to segment)
 |    |--- image1.png
 |    |--- ...
 |--- icons (icons related to the ImagePy GUI)
 |    |--- icon1.svg
 |    |--- ...
doc
 |--- ...
 |--- ...
src
 |--- grain_segmentation.py
 |--- ... (some other files used by grain_segmentation.py)
menus (a new menu will appear in ImagePy)
 |--- Grain-Segment (this will be the name of the new menu)
 |    |--- __init__.py
 |    |--- workflow_plgs.py (contains multiple classes to call the functions of grain_segmentation.py)
 |    |--- workflow.wf (Workflow file, invokes the GUI elements from workflow_plgs.py)
 |    |--- demos
 |    |    |--- __init__.py
 |    |    |--- demo1.mc (also uses grain_segmentation.py)
 |    |    |--- ...
tools (optional, similar structure as for menus)
widgets (optionalm similar structure as for menus)

The grain_segmentation.py file is a module containing a bunch of functions, responsible for the main steps of the segmentation process (reading image, filtering, initial segmentation, skeletonization, final segmentation, etc.). The functions in this module should not know anything about the GUI (ImagePy) and can be used in any Python project once the basic dependencies (numpy, scipy, scikit-image) are fulfilled.

To help experimenting with the parameters of the image processing functions residing in grain_segmentation.py and to perform some tasks manually, ImagePy is used -- its code being in the GUI/ directory.

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.