leb-epfl / sass Goto Github PK
View Code? Open in Web Editor NEWToolkit for simulating real-time control systems for super-resolution microscopy.
License: GNU General Public License v3.0
Toolkit for simulating real-time control systems for super-resolution microscopy.
License: GNU General Public License v3.0
The image that is displayed in the SASS Image Dataset window is always the one before the most recently generated image. This makes the displayed image appear out-of-sync with an analyzer's live view window.
This is not a major problem since you can click the right arrow button on the slider bar to display the most recent image. However, if you restart a paused simulation after doing this, the live image lags the actual image by one again.
Is the MATLAB folder still necessary, or can it be removed from the project directory without breaking functionality?
This will ensure that they are serializable, both as classes and as JSON strings.
Currently the rate coefficients in the photodynamics models depend on the laser power, but a more accurate physical model would have them depend on the illumination irradiance (power per area). This necessitates a model for the illumination profile on the sample. It should
Furthermore, the fluorophore models will need to be changed to respond to their local irradiance values. Currently they output a fixed number of photons per frame; instead, their photon counts should depend on the irradiance. See https://gist.github.com/hadim/6021276da3d41e246ff688e5a05d07e1 for an example of how to model this in Python.
In the FAQ, the coordinate system is defined twice, but differently:
How is the coordinate system in SASS defined?
"Please note that the origin of the Cartesian coordinate system lies at the center of a pixel, not at a corner."
How are custom fluorophore position lists formatted?:
"The units of the values are in pixels, and the origin is in the upper left-hand corner of the generated image stacks."
Is one wrong or are there two different coordinate systems?
bsh % source("/home/kmdouglass/src/SASS/scripts/example_run_generator_dSTORM.bsh");
// Error: // Uncaught Exception: Method Invocation this.interpreter.source : at Line: 14 : in file: /bsh/commands/source.bsh : this .interpreter .source ( filename , this .caller .namespace )
Called from method: source : at Line: 17 : in file: <unknown file> : source ( "/home/kmdouglass/src/SASS/scripts/example_run_generator_dSTORM.bsh" )
Target exception: Sourced file: /home/kmdouglass/src/SASS/scripts/example_run_generator_dSTORM.bsh : Typed variable declaration : Object constructor : at Line: 28 : in file: /home/kmdouglass/src/SASS/scripts/example_run_generator_dSTORM.bsh : new dStormProperties ( 2500 , 50 , 0.001 , 5 , 2 , 15 , 100 , 500 )
Target exception: java.lang.IllegalArgumentException: Rate scaling matrix dimensions do not match the number of states.
java.lang.IllegalArgumentException: Rate scaling matrix dimensions do not match the number of states.
at ch.epfl.leb.sass.simulator.generators.realtime.StateSystem.<init>(StateSystem.java:73)
at ch.epfl.leb.sass.simulator.generators.realtime.fluorophores.dStormProperties.<init>(dStormProperties.java:80)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at bsh.Reflect.constructObject(Reflect.java:621)
at bsh.BSHAllocationExpression.constructObject(BSHAllocationExpression.java:117)
at bsh.BSHAllocationExpression.objectAllocation(BSHAllocationExpression.java:108)
at bsh.BSHAllocationExpression.eval(BSHAllocationExpression.java:56)
at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
at bsh.BSHVariableDeclarator.eval(BSHVariableDeclarator.java:80)
at bsh.BSHTypedVariableDeclaration.eval(BSHTypedVariableDeclaration.java:78)
at bsh.Interpreter.eval(Interpreter.java:659)
at bsh.Interpreter.source(Interpreter.java:577)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at bsh.Reflect.invokeMethod(Reflect.java:131)
at bsh.Reflect.invokeObjectMethod(Reflect.java:77)
at bsh.Name.invokeMethod(Name.java:852)
at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:69)
at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
at bsh.BSHReturnStatement.eval(BSHReturnStatement.java:42)
at bsh.BSHBlock.evalBlock(BSHBlock.java:125)
at bsh.BSHBlock.eval(BSHBlock.java:75)
at bsh.BshMethod.invokeImpl(BshMethod.java:356)
at bsh.BshMethod.invoke(BshMethod.java:252)
at bsh.BshMethod.invoke(BshMethod.java:180)
at bsh.Name.invokeLocalMethod(Name.java:911)
at bsh.Name.invokeMethod(Name.java:798)
at bsh.Bbsh % SHMethodInvocation.eval(BSHMethodInvocation.java:69)
at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
at bsh.Interpreter.run(Interpreter.java:471)
at java.lang.Thread.run(Thread.java:745)
The problem is likely that the state system constructor inside the dStormProperties constructor is called with the wrong value for the number of states:
state_system = new StateSystem(5, Mk);
Above, you can see that 5
is passed as the argument, but there are 4 states in this implementation of the dSTORM model.
It should be renamed to obstructors.commands.internal
for consistency with the rest of the project.
The likely cause of the problem is that the controller in the ALICA_ACPack is not having its properties correctly set. This might mean that they are simply not connected in the GUI initialization.
The RemoteSimualtionService
is auto-generated code by Thrift and is significantly bringing down the code coverage. It should be removed from the coverage reports since it will likely never need to be tested directly.
I get the following class not found error after having merged the new, reduced-size ALICA .jar file in the project:
Exception in thread "Thread-12" java.lang.NoClassDefFoundError: ch/epfl/leb/alica/AlicaLogger
at ch.epfl.leb.alica.controllers.selftuningpi.SelfTuningController.initSequence(SelfTuningController.java:92)
at ch.epfl.leb.alica.controllers.selftuningpi.SelfTuningController.nextValue(SelfTuningController.java:86)
at ch.epfl.leb.sass.ijplugin.Worker.run(App.java:222)
Caused by: java.lang.ClassNotFoundException: ch.epfl.leb.alica.AlicaLogger
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
This error appears immediately after clicking the Calibrate button for the self-tuning PI controller in the GUI simulation environment. Before clicking this button, everything works as expected. The simulation also works perfectly when using the Manual controller.
This will prevent any errors associated with "exotic" components in the ALICA_ACPack, such as the one personally reported to me by @tlambert03 and associated with DEFCoN.
If I had a dime every time this happens to me...
bsh % source("/home/kmdouglass/src/SASS/scripts/example_run.bsh");
// Error: // Uncaught Exception: Method Invocation this.interpreter.source : at Line: 14 : in file: /bsh/commands/source.bsh : this .interpreter .source ( filename , this .caller .namespace )
Called from method: source : at Line: 8 : in file: <unknown file> : source ( "/home/kmdouglass/src/SASS/scripts/example_run.bsh" )
Target exception: Sourced file: /home/kmdouglass/src/SASS/scripts/example_run.bsh : Typed variable declaration : Constructor error: Can't find constructor: ch.epfl.leb.alica.controllers.selftuningpi.SelfTuningController( int, double, int, double, double ) in class: ch.epfl.leb.alica.controllers.selftuningpi.SelfTuningController : at Line: 23 : in file: /home/kmdouglass/src/SASS/scripts/example_run.bsh : new SelfTuningController ( 10 , 0.1 , 2 , 0.1 , 2.0 )
An error is thrown when asked to load the background .tif file because there is a method that is executed some time after clicking the "OK" button in the load dialog that automatically appends a backslash to the path.
They are currently in an internal path, which doesn't make sense given the rest of the project layout: ch.epfl.leb.sass.models.fluorophores.internal.dynamics
I should also think about whether it makes sense to make FluorophoreDynamics
an interface, rather than an abstract class.
No matter what I try, I can't properly launch the BeanShell console through FIJI. I think it might be a problem with the way PlugInFrame
is implemented, will try to refactor it as PlugIn
Camera noise is currently modeled within Device.java, where the number of photoelectrons is determined from a Gamma distribution.
for (int row=0; row < image.length; row++) {
for (int col=0; col < image[row].length; col++) {
image[row][col] += camera.readout_noise*gaussian.nextDouble() +
camera.thermal_noise*gaussian.nextDouble() +
gamma.nextDouble(image[row][col]+0.01f,camera.quantum_gain); //0.01f so that we dont do nextDouble(0,c)
}
}
However, I think that the Gamma distribution is used to model multiplicative noise from the EMCCD's multiplication register, which is absent on a CMOS device.
See Basden, Haniff, and MacKay, Mon. Not. R. Astron. Soc. 345, 1187-1197 (2003)
It may be worth creating a separate noise model for each type of camera that the user may select from.
Numerical aperture, wavelength, and magnification are currently camera properties. They should be moved to a different abstraction layer (or a new one) representing the microscope system/optics.
From @MStefko --
In order for SASS build to work independently, we need to do 2 things:
- Make maven-shade-plugin ignore the ALICA_ACpack.jar when creating the uber-jar (so that the classes in ALICA_ACpack are not included in SASS.jar)
- Make the build system manually copy ALICA_ACpack.jar from the repository into the output folder (SASS/target/).
For number 1, I haven't looked into it yet but should be a fairly simple entry of a few lines into the ... maven-shade-plugin ... section of pom.xml.
For number 2, the following snippet entered into ... works:
<!-- This plugin will download ALICA_ACPack and put it in output
directory. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.github.LEB-EPFL</groupId>
<artifactId>ALICA_ACPack</artifactId>
<version>0.0.0</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory>
<destFileName>ALICA_ACPack.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</plugin>
The loggers will raise the following error when calling saveLogFile()
if a log file with the same name exists and the logger has never been called before.
Nov 05, 2017 10:34:37 AM ch.epfl.leb.sass.commandline.CommandLineInterfa
ce main
SEVERE: EvalError while executing shell script.
Sourced file: scripts/example_loggers.bsh : Method Invocation positionLo
gger.saveLogFile : at Line: 131 : in file: scripts/example_loggers.bsh :
positionLogger .saveLogFile ( )
Target exception: java.io.IOException: No such file or directory
at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:91)
at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
at bsh.Interpreter.eval(Interpreter.java:659)
at bsh.Interpreter.source(Interpreter.java:577)
at bsh.Interpreter.source(Interpreter.java:590)
at ch.epfl.leb.sass.commandline.CommandLineInterface.main(Comman
dLineInterface.java:104)
Caused by: java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1012)
at ch.epfl.leb.sass.simulator.loggers.PositionLogger.saveLogFile
(PositionLogger.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at bsh.Reflect.invokeMethod(Reflect.java:131)
at bsh.Reflect.invokeObjectMethod(Reflect.java:77)
at bsh.Name.invokeMethod(Name.java:852)
at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:69)
... 6 more
The loggers will gracefully avoid an error by appending a number to the filename, but only if the the saveLogFile()
method has already been called.
I'm currently testing AutoLase and for this I need to simulate images that are uncorrelated in time. One way to do this would be to increment the simulation time step and record every N'th image, where N is chosen to be suitably large so that all the molecules have undergone several switching cycles.
I therefore propose adding an additional method to the STORMsim that is similar to getNextImage but does not add an image to the stack.
This interface should be created so that future classes that utilize a simulator will work regardless of the type of simulator that they are using.
The current photophysical model only supports PALM-like photophysics; i.e. the off state lifetime is inversely proportional to the laser irradiance. This means that we never see any fluorescence in the simulations if the set point starts at and remains zero.
In the near future, we'll likely want to add a direct STORM model whereby the off state lifetime is modeled as
t_off = c_0 + c_1 / I_{UV}
The value c_0 is actually proportional to the visible light irradiance (to first order) and depends on the buffer conditions. It can be easily measured in the lab.
Interfaces should be implementation-agnostic, i.e. you shouldn't care which specific implementation of the interface you are talking to when you use one of the interface's methods.
setCustomParameters(Map map)
obviously breaks this pattern, since you need to know what are the keys that the class expects to find inside map
.
getCustomParameters()
could in theory be kept, since you could iterate over the returned map to e.g. print all parameters of the simulation, but that is again skimming the implementation-specific line.
These two methods are not required for the interface to work and should be removed.
Can the Camera field acq_speed
be deprecated and eventually removed without problems? I could not find where it's linked to any functionality...
Since STEADIER-SAILOR uses a different version of ImageJ (FIJI runs on Java 1.8.0, MicroManager runs on 1.6.0), loading Analyzer
s and Controller
s from ALICA can fail (java.lang.UnsupportedClassVersionError
is thrown). We need to reconcile the JDK versions.
The save dialog in the GUI initialization screen reads "Open" instead of "Save."
These methods are part of the ImageGenerator interface but it's not quite clear what they're used for from the Javadocs.
The scripts in the GitHub repository reflect the changes made after refactoring the project architecture, but the latest .jar file under releases does not. The scripts are therefore incompatible with the release.
I should cut a 0.7.0 release to address this.
I pulled the 0.6.0 release, and built it myself using NetBeans 7.1 with JDK 8u152 (I didn't modify the build.xml). The resulting JAR file is 27MB (left) instead of 57MB (right).
Comparing the two JARs shows that the released JAR (right) includes the /lib/ directory with all source JAR files. However I think this is not necessary, since the build script automatically includes all the dependent classes (as can be seen, that for example the org.micromanager.... folder is included). It's probably a NetBeans glitch. @kmdouglass can you check that your Project Properties setting looks the same? The key is probably the /lib/
entry in the Exclude From JAR File
field.
Now that the distance units in the simulator are agnostic, these method names should change to remove the Um2.
The getPixelSize()
method of the Microscope class should also possibly be renamed to reflect the fact that it is the image space pixel size, not the object space pixel size.
@MStefko , should I expect any major issues if I update the version of ALICA included with SASS to the latest version?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.