Giter Site home page Giter Site logo

alexblaessle / pyfrap Goto Github PK

View Code? Open in Web Editor NEW
17.0 8.0 8.0 9.11 MB

PyFRAP: A Python based FRAP analysis tool box

License: GNU General Public License v3.0

Python 97.17% GLSL 2.58% Shell 0.18% Batchfile 0.06%
frap fluorescence-microscopy-imaging python gui frap-analysis frap-experiment pde data-fitting

pyfrap's Introduction

PyFRAP: A Python based FRAP analysis tool box.

Fluorescence Recovery After Photobleaching (FRAP) is a common way to assess molecular diffusion. PyFRAP is a novel simulation-based analysis software that makes use of PDE simulations to analyze FRAP experiments in 3D geometries. It uses the first post-bleach image as initial condition, making assumptions about the underlying initial conditions obsolete. PyFRAP can fit different reaction-diffusion models to FRAP data, providing quantitative information about effective diffusion.

Features

PyFRAP comes with a full image analysis and simulation toolbox. In particular, PyFRAP can

  • Import FRAP datasets from timelapse experiments and analyze image data with various options such as
    • image filters
    • background substraction
    • illumination correction
  • Simulate the FRAP experiment with exact interpolated initial conditions
  • Fit simulated experiment to analyzed data and extract diffusion coefficient
  • Statistical analysis of fitting results
  • Hierarchical data structure making data exchange/sharing easy
  • Comprehensive GUI, making almost all PyFRAP tools available

Installation

PyFRAP can be installed in different ways. We provide installation scripts that allow an easy installation of PyFRAP in combination with Anaconda, including all necessary Python packages and external softwares. Installation instructions can be found here.

If you are familiar with Python and git, you can install PyFRAP via

git clone https://github.com/alexblaessle/PyFRAP

and:

python setup.py install --user

We highly recommend installing with the --user option, since PyFRAP needs to read/write data files in the installation folder. In some cases, this might lead to file permission issues. For a full installation documentation, have a look at the wiki.

Requirements

PyFRAP depends on

  • numpy>=1.8.2
  • matplotlib>=1.4.3
  • scipy>=0.13.3
  • scikit-image>=0.11.3
  • fipy>=3.1
  • PyQT4>4.10.4
  • vtk>=5.8.0
  • colorama>=0.2.5
  • wget>=3.2
  • gmsh (compiled with TetGen Algorithm) MUST BE Version 2.14.0!

Note that the installation described here installs all necessary packages.

Getting Started

Running the PyFRAP GUI

PyFRAP comes with a comprehensive GUI. It can easily be started by clicking on runPyFRAP.bat (Windows), runPyFRAP.command (OSX) or runPyFRAP.sh (Linux).

If you are using a terminal, cd to your PyFRAP directory and type

python pyfrp/PyFRAP.py

If you are already in a python session, you can simply run

import pyfrp
pyfrp.main()

Note that in the latter method PyFRAP's stdout might get redirected to the python shell you are executing it from.

Running PyFRAP from the command line

PyFRAP is a complete python package and can be imported via

	import pyfrp

Note that PyFRAP has three main submodules: pyfrp.modules, pyfrp.subclasses and pyfrp.gui. If you do not want to use any GUI elements, we recommend only importing the modules you need.

Using the PyFRAP GUI to analyze a FRAP experiment

Check out the PyFRAP wiki's First Steps Section.

API

PyFRAP is fully documented, allowing easy creation of scripts and extensions of the PyFRAP toolbox. The API of PyFRAP can be found here .

Documentation

To learn more about PyFRAP, check out the PyFRAP wiki

pyfrap's People

Contributors

alexblaessle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyfrap's Issues

readStlFile crashes if FRAPBoundarySelector is called before

When calling

from pyfrp.modules import pyfrp_gmsh_IO_module
from pyfrp.modules import pyfrp_plot_module
import sys

sel=pyfrp_plot_module.FRAPBoundarySelector(fn=someImgFile)
c,r=sel.getResults()

d=pyfrp_gmsh_IO_module.readStlFile(someSTLfile)
d.draw(backend='vtk')

I get

Traceback (most recent call last):
  File "readStl.py", line 8, in <module>
    d=pyfrp_gmsh_IO_module.readStlFile(sys.argv[1])
  File "/usr/local/lib/python2.7/dist-packages/pyfrp/modules/pyfrp_gmsh_IO_module.py", line 514, in readStlFile
    mesh=meshstl.Mesh.from_file(fn)
  File "/usr/local/lib/python2.7/dist-packages/stl/stl.py", line 316, in from_file
    fh, mode=mode, speedups=speedups)
  File "/usr/local/lib/python2.7/dist-packages/stl/stl.py", line 85, in load
    name, data = cls._load_binary(fh, header, check_size=True)
  File "/usr/local/lib/python2.7/dist-packages/stl/stl.py", line 102, in _load_binary
    count, MAX_COUNT)
AssertionError: File too large, got 942551865 triangles which exceeds the maximum of 100000000

However, not calling the FRAPBoundarySelector prevents the crash and everything is fine. globals() and locals() are not altered in any significant way.

Basic canvas Dialog error after clicking done

Error traceback below after clicking done basic canvas dialog. No pop-up(s) appear thereafter to continue.
Thanks

Traceback (most recent call last):
File "/home/osboxes/.local/lib/python2.7/site-packages/pyfrp/gui/pyfrp_app.py", line 1561, in openWizard
ret=self.newEmbryo()
File "/home/osboxes/.local/lib/python2.7/site-packages/pyfrp/gui/pyfrp_app.py", line 1365, in newEmbryo
ret=self.editEmbryo()
File "/home/osboxes/.local/lib/python2.7/site-packages/pyfrp/gui/pyfrp_app.py", line 1429, in editEmbryo
self.updatePropBar()
File "/home/osboxes/.local/lib/python2.7/site-packages/pyfrp/gui/pyfrp_app.py", line 1137, in updatePropBar
self.showObjPropsInBar(self.currObj)
File "/home/osboxes/.local/lib/python2.7/site-packages/pyfrp/gui/pyfrp_app.py", line 1115, in showObjPropsInBar
if isinstance(vars(obj)[str(item)],(int,float,str)) or vars(obj)[str(item)]==None:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

After first basic canvas dialoge pyFRAP wizard stops

Traceback (most recent call last):
File "C:\Users\hpreiss\AppData\Local\Continuum\Anaconda2\lib\site-packages\pyfrp\gui\pyfrp_app.py", line 1416, in openWizard
self.newEmbryo()
File "C:\Users\hpreiss\AppData\Local\Continuum\Anaconda2\lib\site-packages\pyfrp\gui\pyfrp_app.py", line 1243, in newEmbryo
self.editGeometry()
File "C:\Users\hpreiss\AppData\Local\Continuum\Anaconda2\lib\site-packages\pyfrp\gui\pyfrp_app.py", line 1590, in editGeometry
ret=pyfrp_gui_geometry_dialogs.zebrafishDomeStageDialog(currEmbryo.geometry,self).exec_()
File "C:\Users\hpreiss\AppData\Local\Continuum\Anaconda2\lib\site-packages\pyfrp\gui\pyfrp_gui_geometry_dialogs.py", line 245, in init
super(zebrafishDomeStageDialog,self).init(geometry,parent)
File "C:\Users\hpreiss\AppData\Local\Continuum\Anaconda2\lib\site-packages\pyfrp\gui\pyfrp_gui_geometry_dialogs.py", line 136, in init
self.drawGeometry()
File "C:\Users\hpreiss\AppData\Local\Continuum\Anaconda2\lib\site-packages\pyfrp\gui\pyfrp_gui_geometry_dialogs.py", line 223, in drawGeometry
self.geometry.plotGeometry(ax=self.ax,ann=self.ann)
File "C:\Users\hpreiss\AppData\Local\Continuum\Anaconda2\lib\site-packages\pyfrp\subclasses\pyfrp_geometry.py", line 333, in plotGeometry
domain.draw(ax=ax,color=color,ann=ann)
File "C:\Users\hpreiss\AppData\Local\Continuum\Anaconda2\lib\site-packages\pyfrp\modules\pyfrp_gmsh_geometry.py", line 978, in draw
ax=pyfrp_vtk_module.renderVTK(ax)
File "C:\Users\hpreiss\AppData\Local\Continuum\Anaconda2\lib\site-packages\pyfrp\modules\pyfrp_vtk_module.py", line 112, in renderVTK
if renderer.GetRenderWindow()==None:
AttributeError: 'Axes3DSubplot' object has no attribute 'GetRenderWindow'

create embryo doesn't produce tiff files

after choosing folder embryo data, embryo creationbutton only creates new folders but no tiffs
WARNING:There are no files of type tif in . This can lead to problems.

Ubuntu: Does not show First recovery Image in Dialog after Embryo creation

In the first Dialog after embryo creation (setting basic image information such as resolution and imaging depth) the "preview" image is not shown.

Traceback (most recent call last):
File "/home/lin2-local/.local/lib/python2.7/site-packages/pyfrp/gui/pyfrp_app.py", line 1235, in newEmbryo
self.editEmbryo()
File "/home/lin2-local/.local/lib/python2.7/site-packages/pyfrp/gui/pyfrp_app.py", line 1285, in editEmbryo
ret=pyfrp_gui_embryo_dialogs.embryoDialog(currEmbryo,self).exec_()
File "/home/lin2-local/.local/lib/python2.7/site-packages/pyfrp/gui/pyfrp_gui_embryo_dialogs.py", line 176, in init
self.showFirstDataImg()
File "/home/lin2-local/.local/lib/python2.7/site-packages/pyfrp/gui/pyfrp_gui_embryo_dialogs.py", line 277, in showFirstDataImg
img=pyfrp_img_module.loadImg(fnImg,self.embryo.dataEnc)
File "/home/lin2-local/.local/lib/python2.7/site-packages/pyfrp/modules/pyfrp_img_module.py", line 688, in loadImg
img = skimage.io.imread(fn).astype(enc)
File "/usr/lib/python2.7/dist-packages/skimage/io/_io.py", line 97, in imread
img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
File "/usr/lib/python2.7/dist-packages/skimage/io/manage_plugins.py", line 209, in call_plugin
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/skimage/io/_plugins/pil_plugin.py", line 34, in imread
im = np.fromstring(im.tostring(), dtype)
File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 695, in tostring
"Please call tobytes() instead.")
Exception: tostring() has been removed. Please call tobytes() instead.

"The System cannot find the path specified." (Building embryo)

I pulled the most recent version and I now get the following error in PyFRAP when building the embryo:

"WARNING (mkdir): Could not create folder \\...\...\...\David\Data\FRAP\Sqt-GFP_PyFRAP\2017_04_11\ .
WARNING (updateFileList): There are no files of type tif in \\...\...\...\David\Data\FRAP\Sqt-GFP_PyFRAP\2017_04_11\recover/ . This can lead to problems."

In the terminal it says "The System cannot find the path specified."

EDIT: Actually, I think this is not a Windows problem only. I get the same under Ubuntu.

When calling select fits in PyFRAP Statistics menu

File "/usr/local/lib/python2.7/site-packages/pyfrp/gui/pyfrp_app.py", line 2084, in summarizeMolecule
    self.selectFits()
  File "/usr/local/lib/python2.7/site-packages/pyfrp/gui/pyfrp_app.py", line 2052, in selectFits
    ret=pyfrp_gui_statistics_dialogs.fitSelector(self.currMolecule,True,self).exec_()
  File "/usr/local/lib/python2.7/site-packages/pyfrp/gui/pyfrp_gui_statistics_dialogs.py", line 65, in __init__
    pyfrp_gui_basics.listSelectorDialog.__init__(self,[],parent,leftTitle="Available Fits",rightTitle="Selected Fits")
  File "/usr/local/lib/python2.7/site-packages/pyfrp/gui/pyfrp_gui_basics.py", line 307, in __init__
    super(listSelectorDialog,self).__init__(parent)
TypeError: QDialog(QWidget parent=None, Qt.WindowFlags flags=0): argument 1 has unexpected type 'list'

KeyPressEvent fails in DefaultROI selection

KeyPressEvent callback is somehow now working. Error message:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_qt5.py", line 315, in keyPressEvent
    FigureCanvasBase.key_press_event(self, key)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 1833, in key_press_event
    self.callbacks.process(s, event)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/cbook.py", line 540, in process
    proxy(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/cbook.py", line 415, in __call__
    return mtd(*args, **kwargs)
TypeError: keyPressed() takes exactly 1 argument (2 given)

Somehow mesh.fnMesh becomes overwritten by mesh.mesh

After readjusting the mesh volSize via Simulation->Mesh->Mesh Settings, we get the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pyfrp/gui/pyfrp_app.py", line 1756, in generateMesh
    self.editMesh()
  File "/usr/local/lib/python2.7/dist-packages/pyfrp/gui/pyfrp_app.py", line 1742, in editMesh
    ret=pyfrp_gui_mesh_dialogs.meshSettingsDialog(currEmbryo.simulation.mesh,self).exec_()
  File "/usr/local/lib/python2.7/dist-packages/pyfrp/gui/pyfrp_gui_mesh_dialogs.py", line 72, in __init__
    self.updateFnMeshLbl()
  File "/usr/local/lib/python2.7/dist-packages/pyfrp/gui/pyfrp_gui_mesh_dialogs.py", line 127, in updateFnMeshLbl
    self.lblFnMeshVal.setText("..."+self.mesh.fnMesh[-self.nCharDisplayed:])	
TypeError: 'GmshImporter3D' object has no attribute '__getitem__'

which clearly points that mesh.fnMesh now contains what should be in mesh.mesh. This either happens in pyfrp_mesh class itself or in settings dialog.

Cannot find path under Windows

When trying to prepare .czi files to create an embryo file:
"The system cannot find the path specified.
mv: cannot stat '\f......': No such file or directory"

Progress bar not working under OSX

It seems that in general QThreads block any other interaction with the GUI. It actually already blocks the initiation of the __init__ of the progressbar dialog. It might be worthwile to introduce a thread.sleep at the start of thread initiation.

Windows: Geometry in Geometry window looks awkward (too small)

The 3D Geometry on the right side of the Geometry is too small in Windows and IS NOT adjustable by increasing the size of the window:
pyfrap_geometry_dialog

Also, the window size in the ROI selection dialogs is a bit weird, because by default the lower panels are "squished". But this can be adjusted by changing the window size:
pyfrap_default_window_size

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.