mmstudio: Various improvements to mmstudio

mmstudio: fix crash when closing ImageJ with closeOnExit = true

Some stuff was released but the Quit handler tried to release it again.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

ZWheelListener: do not expect the zStageLabel to be null

MMCore cannot return a zStageLabel that is null, only an empty one.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

ReportingUtils: add a convenient logException() method

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

MMStudio: output more details on mmplugins to CoreLog

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

MMStudio: do not discover mmplugins/ wherever we might current be

Always discover mmplugins/ in the ImageJ directory.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Never use the system class loader

We really have to keep in mind that it's not our business to expect a
certain way and only that way how to call Micro-Manager!

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Report MMStartup errors much better

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Revert "Not sure if there are side-effects, but ignoring the focusLost event makes the property editor a lot nicer to work with"

There is a side effect. When typing a new value for a property and cliking
"Set" without pressing the Enter key first, the new value is completely
ignored... :-(

This reverts commit 2244c0874260011448e646d2a988d132382318e3.

Load AcqEngine classes with the same class loader as MMStudio itself

This should avoid class loading issues in case somebody loads the
studio using custom class loaders.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a sample MMStartup.bsh that starts the SPIM plugin by default

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Ported Micro-Manager/plugins to Commons Math 3-ish

Ported MicroManager/plugins to Commons Math 3ish

Started porting MicroManager and plugins to commons math 3.

We really need to condense these down to one of two versions, and there's
no sense using version 2 when 3 is available.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Finished 'porting' plugins and associated to Commons Math 3.0

By 'porting' I mean 'lobotomizing'. I'm pretty sure I didn't actually
comment out functionality-critical code, though some metadata code won't
work until I find the new functionality analogues and fix them.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>
Added File>Batch Convert Movies

Add File>Batch Convert Movies

This Beanshell will simply use ImageJ 1.x for the user interface and will
hand off to VLC to do the job (if VLC is not installed yet, it will open
the appropriate website).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Batch Convert Movies: support Linux, too

Since Windows is such a special platform, we have to special-case it,
but the other platforms are easier: we simply look whether we can
find vlc in the PATH.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Fix tyop in Batch_Convert_Movies

The corresponding exception was noticed by Pavel Tomancak.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Batch_Convert_Movies: support MacOSX

This is a companion commit to fiji.git's 2e33a490(Make_Screencast.bsh:
also search for VLC at its default location on MacOSX) by Jan Eglinger.

Unfortunately, it seems as if current VLC (2.0.5) segfaults when called on
the command-line on MacOSX 10.5, as reported by Pavel Tomancak, although
it worked fine on MacOSX 10.6.8.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Added better IV/step guessing to GaussianFit

The GaussianFit plugin had very undesirable results before; I've added
parameters to the constructor that will enable some 'better' (for our
purposes, anyway!) guessing of the initial values and step sizes. This
shouldn't break compatibility with other code.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>
Added rename-blubs (obsolete?)

Add a macro to prepare time-lapse files for SPIM Registration

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Fixes for Rename Blubs

Rename Blubs: use a format closer to what SPIM Registration expects

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Brown-paper bag fix in Rename_Blubs

Note to myself: when sorting, use the result.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Added make-app.sh

make-app: Use Package Maker's new --prefix option

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Add a shell script to make a clean OpenSPIM software release

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Added make-dev-env.sh

Add a script to make the development environment installer

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Include the shortcut making programs in the development environment

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Created Ant build files for plugin

Created Ant build files for all plugins

Began updating/creating Ant build files for all plugins.

As part of the conversion to commons math 3, I've created ant build files
for all but two of the plugins (well, one, but Gaussian doesn't work yet
for code reasons).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Finished creating Apache Ant build files for all plugins.

All plugins now have ant files that will compile. As an added bonus,
plugins/build.xml will invoke the given target for every **/build.xml in
plugins.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>
FIXUP: Visual Studio projects: copy to bin_Win{32,64}/mm/win{32,64}

To fit the upstream convention of using bin_$(Platform) for build
destinations, all Visual Studio projects' copy-to paths have been changed
from dist/.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Avoid MFC as dependency

It is not really a dependency to begin with :-)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a Visual Studio project for mmstudio

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Windows: make sure that all search paths are added to PATH

... otherwise, dependencies might not be found when installed alongside
the Micro-Manager drivers, as needed by Fiji.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a makefile for the acq engine (win32)

The makefile will need to be altered for different
platforms/architectures.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
For now, do not try to load the secret device adapters into the workspace

... because Dscho does not have access to them...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Added start.sh

start.sh stuff

Rather than writing start-openspim.sh from openspim.sh, have a start.sh

This makes updating easier, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Do not try to overwrite bootstrapped Fiji

When Fiji is initialized with bin_Win32/bootstrap.sh, ImageJ.exe does not
exist -- intentionally.

Our startup script should therefore look for ImageJ-win32.exe as a
tell-tale whether the built Fiji should be copied or not.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

start.sh: make sure that stderr is shown in the console

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Merged start.sh

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>
Added build.sh

Extract build.sh from openspim.sh

Better not to hide that useful script in that monster script...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Adapt build.sh for the switch away from dist/

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Added SPIMAcquisition plugin

Created Ant build file for SPIMAcquisition plugin

Began updating/creating Ant build files for all plugins.

As part of the conversion to commons math 3, I've created ant build files
for all but two of the plugins (well, one, but Gaussian doesn't work yet
for code reasons).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Finished creating Apache Ant build files for all plugins.

All plugins now have ant files that will compile. As an added bonus,
plugins/build.xml will invoke the given target for every **/build.xml in
plugins.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added SPIMAcquisition plugin

Beginnings of a MM Plugin to do SPIM Acquisition

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Make the SPIM plugin do things

In theory, everything Move_Motors.bsh could do...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: avoid conflicting motor update threads

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: while updating a slider, show the value with yellow background

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Fix funny tick spacing

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: fix z updating

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: optionally limit the x, y, z ranges to 500-2500

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: make limited range adjustable

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: make the angle range -180 to +180

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: For now, disable two checkboxes

... since there is no functionality behind it yet...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: First stab at adjusting the exposure

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: also trigger updates in integer fields when focus was lost

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: store some metadata (no calibration yet)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

First stab at continuous snapping

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Fix for negative inverted z range

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Try to fix continuous snapping and add more debugging output

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: add a GUI for the velocity control

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Fix Micro-Manager Error: ...updateImage(...)

... hopefully...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Disable the continuous mode for now

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Fix faulty coupling between rotation slider and angle input field

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: add a delay-to-settle

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Really fix Micro-Manager Error: ...updateImage(...)

... hopefully...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Disable UI elements when snapping a stack

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Handle previously forgotten items in updateUI()

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: allow the user to abort

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: persist range limits, z range, exposure, laser power and delay

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Hopefully fix threading issues

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM plugin: use the new ReportingUtils.logException() method

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: for now, log the motor actions extensively

This seems to prevent freezes for the moment.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: always use ReportingUtils to log messages

While at it, indent them correctly as they're probably here to stay.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM: turn off live mode when acquiring the stack

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Try to sleep to prevent freeze

That try was not successful...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

synchronized snapImage in live view and stack acquisition.

converting steps to angles

fixed a bug with range limiting for the motor sliders.

Add Zoom In/Out buttons to SPIM's 'limit' boxes

Signed-off-by: Tobias Pietzsch <tobias.pietzsch@gmail.com>

SPIM: even more defensive programming

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Refactor MotorSlider

We cannot inherit from JSlider if we want to add arrow buttons...

Signed-off-by: Tobias Pietzsch <tobias.pietzsch@gmail.com>

Add +/- buttons to the sliders

Shift+Click on +/- increments by 10 now

SPIM: make +/- buttons smaller

SPIM: user BorderLayout for the sliders

SPIM: refactor in preparation for auto-updating the motor positions

SPIM: update the motor positions when focus was gained

Adjust the SPIM plugin to the current API

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM plugin: unify conversion between twister position and angle

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

TOFIX: make SPIMAcquisition debugging easier

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM plugin: make - and + buttons bigger

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

SPIM plugin: show x, y, z, angle labels in debug messages

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Refactored SPIMAcquisition plugin (split nested classes)

SPIMAcquisition.java was pretty muddy; four nested classes (one of which had
its own nested class). I've split them into separate files for clarity.

Added a @SupressWarnings 'serial' to SPIMAcquisition.

Some of the internal classes lacked seralization numbers; a SupressWarnings
made Eclipse be quiet about them.

SPIM Acquisition: clarify the twister-to-angle conversion

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Started work on custom live window for SPIM acquisition.

Per ticket 8 on the bug tracker (http://fiji.sc/openspimbugs/), I've started
writing a customized live window. It will let us directly (and intuitively)
control the motors in the OpenSPIM system, and will eventually help calibrate
the system (i.e. determine the effective axis of rotation in the sample).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Improved SPIM-custom Live Window.

After sorting out some issues with the mouse dragging, I setup an update
timer to automatically refresh the image with the latest from the core.
A few variables (dragStartX/Y) got derefactored, so pardon the messy diff.
:)

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

SPIM Acquisition specifies an 'uncalibrated' pixel if none exists.

The current live window refuses to move the stage without having a pixel
size calibration set. The SPIM Acquisition plugin now specifies a default
pixel size calibration if none exists.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Implemented rudimentary 'rotation' in the live window.

By holding alt and dragging, you can now rotate the twister motor. It
isn't the full implementation, in which we hope to rotate around a
specific axis in 3D space (involves running the stage motors also), but
it's proof that we can hook into the window. :)

(Sort of) Signed-off-by: Luke Stuyvenberg (stuyvenberg@wisc.edu)

Motor sliders now update every second (instead of on focus).

Per the modified implementation of ticket 8, we now update the motor
sliders regularly (so they more precisely match reality). As an
interesting side-effect, it makes more plain the issue of ticket 3
(rotational motor hiccup): degrees that share a two-radian value with
another degree are 'difficult' to go past (since the motor resets to one
of the two possible degrees). This will likely become my next task. :)

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Improved rotational motor live window control (more fluid).

My original method failed to move the twister for mouse movements less
than ten pixels or so, as a side effect of the scaling. This new method is
less jerky for small motions.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

First revision of SPIM calibration class.

It has yet to do anything supremely valuable, but in the future I have
hopes that it will provide for (first manual, hopefully shortly followed
by) automatic determination of the axis of rotation, as well as a method
of choosing the pixel size graphically. This will help the live window
controls react appropriately, as well as let us provide some accurate
metadata for captured images.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Finished manual calibrator UI/pixelsize calc

Finished (manual) calibrator UI and implemented pixel size calculation.

The calibrator's UI (for manual calibration, of course) is more or less
complete, if not entirely interactive. It picks the ROI from ImageJ to
find positions and dimensions. A few of the buttons aren't yet functional,
but the pickers all are, and the pixel size calculator works.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added LayoutUtils class to help with GUI stuff.

The main advantage is that I can now organize components on a panel
without writing the same five lines over and over.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Updated Calibrator UI to use LayoutUtils.

Most of the manual calibration is in place; all we need now is a single
version of commons math and a better sample than the end of a syringe. ;)

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Stopped spam when resetting MM config w/ plugin up

The update sliders code was spamming IJ exception boxes if the user tried
to make a new hardware config or what have you. It ultimately culminated
in a crash. Now, such exceptions are relegated to the console log when
generated by the slider refresh timer.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Twister slider now secretly -100 to 100 [00000003]

I made the twister slider secretly backed by values ranging -100 to 100.
The values displayed to the user are still in degrees, but the values we
use for the motor are all in this range.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Start merging ProgAcq parts into SPIMAcquisition

I've started moving the SPIM tab of ProgAcq into the SPIMAcquisition
plugin, per mantis 00000010. It's haphazard, and not really melded quite
yet, but it's a start. :)

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

[00000034] Add continuous acquisition to ProgAcq.

ProgAcq now supports continuous acquisition. Sort-of. The framerate could
be better, likely a result of using snapImage without a circular buffer?
This needs to be investigated before the ticket can be closed.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

SPIMAcquisition plugin stuff

[00000007] Improve SPIM calibrator tool.

Yes, I know it isn't actually available for use yet, but the calibrator
now functions a little more sensibly.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Fixed makeLabelTable to be a little more robust

There were some issues with over/undershooting the number of labels and
other such; this new version of the method should be a little better...

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Can now use current stage position for acquisition range

I added buttons to import the current X/Y/Z/T stage positions (plus/minus
given bounds) for use in acquisition. This way, you can find a good spot
in live, then pick it (probably for Z) and get the above/below N slices.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Changed ProgAcq to accept a parameter wrapper

Before it got *really* messy...

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

More SPIMAcquisition plugin goodies

Added a progress bar to acquisition.

Partly for fun, partly for use, and partly to test out the parameter
wrapping class, I've added a progress bar to the acquisition tab. It
slowly ticks up while the acquisition occurs.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

[00000007] Sub-resolution rot. axis calibration

Started implementing it. It's not automatic yet, but users now Pick Bead
instead of picking an icky pixel rectangle. Unfortunately, it adds a new
dependency -- the GaussianFit plugin...

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Heavily refactored SPIM Calibrator.

A calibration source makes more sense as an interface for now; I've moved
all the code I've been working on into SPIMManualCalibrator. There were a
few changes to the functionality of the calibrator also.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

[00000007] Added load/save/apply for calibrator.

Load and save are simple conveniences for testing, though if we have a
particularly stable sample arm, it's possible the saved axis will remain
valid. The 'apply' bit will now use your pixel size calibration in
Micro-Manager.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

[00000008] Live window rotation only when focused.

The live window will now only rotate when it's focused. This stops the
occasional weird jump of the theta motor that's been plaguing my
calibration testing...

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

[00000007] Implemented multi-view in acquiring.

Thankfully, because the performAcquisition caller is the code that makes
the rules, it was really straight-forward. It's not exact, though; the Z
stage doesn't find its location correctly yet.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added ability to save captured images individually.

Still needs testing.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Some cleanup in SPIMAcquisition.java.

Fixed some whitespace, removed some evil debug messages, etc.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Changed timelapse interval to be in seconds.

In hindsight, milliseconds is really improbable. Still, the time can
probably be entered as a double, so if you need sub-second time lapses, it
should still be possible.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added list-of-positions acquisition tab.

It's a bit messy yet, and the layout issues plaguing the table frustrate
me to no end, but there it is...

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Fixed some formatting issues of the table entry

Finally!

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added the ability to guess a third point.

As a start of automatic calibration, I implemented a 'guess the third
position'. After selecting two points during calibration, the user can
click 'guess' to try and reposition the stage to show where the third
point should be, using an approximation of the axis as vertical. It
doesn't seem to guess right yet, and I'm not sure how to improve the
accuracy except possibly by wider angles. Requires further testing.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added an available-space indicator on acquisition

A bit of text now indicates the available space in whatever destination
the system will be acquiring to (that is, RAM or disk, depending on
whether individual saving is selected), as well as an estimate for how
much space will be used.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added a directory browser for individual saving

So users can select a particular directory without having to guess at the
correctness of the path.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Improved two-point guessing a little.

Defaults to a 'correct' direction, moves ROI to surround the guess. Needs
some greater detection.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Started implementing depthwise 'fitting'.

By holding Alt when clicking on a picker button, the calibrator will cycle
up and down Z and use an intensity-weighted average (hopefully!) to try
and determine the center of the bead in Z as well. It will hopefully help
calibration be more accurate.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Quick whitespace fixing

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Started showing signs of automatic calibration

It doesn't actually work yet, but I wanted to get this file into the
repository. SPIMAutoCalibrator.java will eventually become a
mostly-automatic calibration class. Also added a super-secret testing
doo-dah to the main interface which instantiates said calibration class.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Made two-point guessing a bit more robust.

If it can't find the bead using the first assumption of direction, it
tries checking the other. I may need to increase the search range; when it
DOES predict the correct location in X/Y, the Z is sometimes off far
enough to throw the search.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Massive upgrades to (semi-)auto calibrator.

It now looks like something I might eventually be able to convince myself
to release. The detection could use some work yet, and I haven't found a
good way to go around a huge chunk of the circle -- preferably well over a
quarter -- but those are minor issues to be fixed later.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Corrected rotation angle, image estimates.

I was telling it to rotate backwards (Positive angles on our twister is
-k; Commons Math rotations are +k). The image estimates were multiplying
by zero for empty (i.e. disabled) ranges, which would propagate to say
there were no images whatsoever. Also removed some incorrect
documentation.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Further improvements to autocalibrate reliability.

Put a sleep in the right place to let the live window update -- this
should actually be replaced by stopping live and acquiring manually. Also
changed weighting to intensity-to-background ratio.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Improved autocalibration some more

Fixed default parameter guessing to be a little more accurate, added a
bunch of temporary debug readout stuff to the auto calibrator (clean up
when done!)

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added precise name control for individual files...

...when saving individual images through ProgAcq. Users can specify a
naming scheme with %t meaning time and %n being the nth device in the
device list. Might be cumbersome. Not tested!

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Reversed Z/Theta in SPIM Acquisition plugin.

Completely; including acquisition order (doh!). Also still needs testing.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added a scanning tweaks (temporary)

Until I can nail down good settings, I've made all of them modifiable from
runtime (so I don't have to recompile over and over...Added a scanning
tweaks (temporary).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added a 'view in 3D' button to the autocalibrator.

Less copypasta, more examination of the results.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Finished automating calibrator.

I need a good sample to test it on, and there's a few tiny software
glitches to iron out, but otherwise it works pretty well.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added an 'import' on autocalibrator...

...so I can test rotation without having to calibrate each day.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Potential-bug fix: Rotation with no initial pos.

There was a possibility of trying to rotate based off old or missing
initial-stage-location information. Fixed.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Provided smarter initial values for autocalibrator

Basically, I've been tweaking the calibration settings, and now I've
changed their defaults for better reliability.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added 'quick-fitter' to autocalibrator.

By holding Control over the live window, you can see the gaussian fitter
in action. This is mostly a developer tool; we may wish to scratch this
for release.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Began implementing ruler-method um/pix calibration

The autocalibrator has no way of determining this yet -- I've been using a
pre-set value of 23 pixels per 10 'um' (motor steps, actually).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Reworked ProgAcq to handle output in a modular way

In order to better facilitate things like writing OME-TIFF files (without
sacrificing the ability to acquire images very simply), I moved the output
handling into two classes which implement an overarching interface. The
acquisition code now calls a function inside said classes which handles
the tagged and wrapped image data neatly.

With these changes in place, all I have to do is add a new class to write
out OME-TIFF files and pass the acquisition that class (with a few
parameters to help it along).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Beginning implementation of OME-TIFF handler

It has a few issues yet -- specifically it always throws an exception
during finalize(), but this is relatively minor. Will likely need some
serious adjustments as I get a feel for the OME-TIFF architecture.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Reworked ProgAcq to handle output in a modular way

In order to better facilitate things like writing OME-TIFF files (without
sacrificing the ability to acquire images very simply), I moved the output
handling into two classes which implement an overarching interface. The
acquisition code now calls a function inside said classes which handles
the tagged and wrapped image data neatly.

With these changes in place, all I have to do is add a new class to write
out OME-TIFF files and pass the acquisition that class (with a few
parameters to help it along).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

OME-TIFF handler multidimensional-capable patch 1

Probably of 2. It's almost done, but I can only seem to convince it to
save the last N images; the remaining images are wiped out, though their
metadata persists.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Minor fixes to file size estimation

I cut off the exabytes label -- outside the range of integers -- and added
a 2.5kB overhead for each image.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Make auto-calibrator default

Before you had to hold Alt to use the automatic calibrator instead of the
manual one. This behavior has been reversed; the manual calibrator is now
only accessible by holding Alt the first time you click Calibrate.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added 'fitting overlays' tweak

When checked, all gaussian fits are given visual overlays so the user can
see where the fitter believes the signal is.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Modified fitting overlay coloring

So now you only see a green overlay when the currently selected method has
found a new best Z.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Fix build paths of the Ant projects

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

The 'build' Ant targets all depend on 'compile'

Before building the .jar files, the .java files better be compiled...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Get rid of ProgAcq's 'Save Individual' checkbox

If the user specifies a directory, we know already that she wants to save
the images...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Avoid illegal array access

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Temp workaround: A file was forgotten

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Modified ProgAcq to better understand stacks

Also hid some of the dirt from the user -- there's probably quite a few
changes to be made yet; I'd like to eventually replace rows of strings
with a StepRow class or the like, to better describe the steps to be
taken. Also, there's probably some unsafe things going on that I'll need
to track down shortly, but pushing this out was a bit of an emergency.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Began implementing AcqRows to update ProgAcq

So now we can do fancier stuff like combat drift, et cetera. It's not
entirely tested yet, so be careful while using it! (The SPIM Ranges tab
definitely works; I tested the position list early, but not recently, so
it might not be functional. Careful with it!)

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Show stacktraces when the programmatic acquisition fails

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Removed old steps approach to AcqParams.

The old List<String[]> option no longer exists; we have to use AcqRow[]
now (it includes useful stuff for stacks and such.).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

First implementation of anti-drift

See comment on issue 78(?) regarding my plan. There's some bugs with it --
possible exceptions during acquisition, I believe -- but I'll be working
them out.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Heavy modifications to output handlers

Added a beginStack method (since it was basically being put into
finalizeStack instead), heavily revamped OMETIFFHandler (lumped into the
same commit because of some modifications with AcqRow).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Tightened up the UI in a few places

I relabeled some things and slimmed down some others. Also forced 'update
live view' to be disabled until such a time as I can make it do something
useful. Turning on 'continuous' mode now disables file output (since the
OME-TIFF handler doesn't understand variable-length acquisitions;
hopefully there's some way to fix that).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Renamed all the hideous members in SPIMAcquisition

Curse me and my love of underscores. I also removed some unused imports.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

[0000077] Added ability to jump to positions.

Just double-click on them to go there. I may also add a button as a fixup
(since we don't actually say anywhere).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

[0000080] Added 'video' capability

In this mode, the plugin just dumps images as quickly as it can to a
temporary directory. When you press stop, it uses IJ to turn them into one
big stack. This will hopefully wind up being updated with metadata written
to an OME-TIFF.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

[0000079] Prompt for overwrite

If you select a directory with anything in it, the system will check to
make sure you want to write there.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Extended motor range to be from 0 to 8000 (incl)

The motors actually support position 0 -- I think the only reason we roped
it off was the sticking troubles Dresden was having, but I think some
other changes I've made might wrap that up.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Various UI improvements & exposure slider fixed

I've implemented the rest of the code for the exposure slider and sped up
the slider updates.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added support for our Cube in Madison.

We'll talk about getting the Dresden setup working ASAP (presumably
Monday). At the moment, the power range is falling back to defaults 0.05mW
- 20mW, but I'm working on that.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Finally patched autocalibrator

Apparently I never got around to restoring the fitting code after
committing the missing FitHypersphere.java.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Stopped querying laser while acquiring

Unfortunately, the Cube DAL doesn't sequence its queries; if a query
occurs before the last is responded to, a timeout error occurs (because
the receive buffer is now empty). I'm considering fixing this in the code,
but for the purposes of acquisition, stopping the queries to the laser is
sufficient.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>
Added ProgAcq plugin

Created Ant build file for ProgAcq plugin

File split from

Began updating/creating Ant build files for all plugins.

As part of the conversion to commons math 3, I've created ant build files
for all but two of the plugins (well, one, but Gaussian doesn't work yet
for code reasons).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Finished creating Apache Ant build files for all plugins.

All plugins now have ant files that will compile. As an added bonus,
plugins/build.xml will invoke the given target for every **/build.xml in
plugins.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

ProgAcq stuff

Added 'progacq' plugin base version (doesn't do anything yet).

This plugin will eventually host the code for our SPIM acquiring process,
although this means it might spontaneously cease being a plugin (becoming
secondary to the SPIMAcquisition plugin).

Added a performAcquisition method to ProgAcq.

This method (overly simplistic right now) will become the workhorse for the
project; it gets passed the steps and sequentially applies the values to the
system's devices, snapping pictures at each point.

Eclipse and I had a formatting diagreement.

Just some more cleanup. No tremendous functionality changes just yet!

Replaced numerous anonymous ActionListener's with an in-class implementation.

This seems to be the preferred behavior within Swing, based on the official
code samples; I've aligned the ProgrammaticAcquisitor class with it.

Added 'SPIM' tab to ProgAcq plugin.

It still needs work -- or to be tossed out entirely, in favor of the already
available plugin -- but it's a little easier to use than the tabular approach
(which is still available via the 'Advanced' tab).

Reworked acquisition code to use ImageJ interfaces.

With much borrowing from SPIMAcquisition.java, ProgAcq's performAcquisition
method now uses ImageJ's ImagePlus format (albeit most likely incorrectly).
Beginning acquisition from the ProgAcq plugin now invokes this method on a
separate thread than the event thread (again, shameless thievery on my part!),
then displays the finished stack.

Fixed some exceptions being thrown by range sliders due to 0 step size.

Attempting to regenerate position lables for the other sliders with a zero
increment was (sensibly) throwing an exception. I've clamped the values for
the purposes of slider ticks and labels.

Threading and error handling revisions to performAcquisition.

I slightly reworked the way peformAndShowAcq functions. It now always
produces a new thread for performAcquisition (regardless of from whence
it was called).  This thread is returned from the function, and should
be interruptable. I also made error handling a little more consistent;
using performAndShowAcq, the exceptions are now passed up the stack to
the thread object, which displays a message box and aborts. This is to
ease the use of performAcquisition (and, to a lesser degree,
performAndShowAcq) by external libraries.

Fixed some irritating cyclic updating in the RangeSlider interface.

Setting a value in a text box was moving a slider which was changing other text
boxes. I never had it form an infinite loop, but it was a danger, and it was
also annoying.

Added interface (GUI) for a simpler n-dimensional acquisition sequence.

A hybrid of the SPIM controls (4D) and the tabular entry (nD). Users can select
any number of ranged devices (at the moment, they must be stages, though other
possibilities are easy enough to implement), then specify a minimum and maximum
value as well as a step size for each.

The Great Cleanup and Commenting Commit

Personally, I like the alliteration. I went through ProgrammaticAcquisitor.java
and commented the methods with javadoc, and also added a few odd comments to
explain the weirder parts of my code (I hope). I also cleaned up the files and
ran Eclipse's auto-formatter over them.

Fixed some initial-value issues in RangeSlider.

I had altered the default step size in setMinMax but not in the constructor.
Rather than the simple fix of altering it in the constructor, I changed the
constructor to invoke setMinMax. More tidy.

Added ability to abort ProgAcq-instigated acquistion sequences.

Pretty straightforward; improves the usability of the plugin (some of the
acquisition sequences can get pretty long, and the demo stages don't even
simulate a delay...).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Condensed the condenseXY method back into its only caller.

condenseXY was only being called once, so I removed it and put its code in
place of the method call. I believe at one point I expected it might be used
elsewhere, but I can always extract it again later.

Fixed implementation of performAcquisition's timestep argument.

It used to be a delay (because that was the simpler thing to implement). Now,
the method tries to make each sequence start on time (such that it won't wait
at all if the sequence should've restarted already). This allows, conceptually,
something like "take a picture of this sample from every angle at 30-second
intervals".

Updated generateMeta to truncate decimals, and added some units.

When the stage is at 4000.00000000001, you get the point after the first four
zeroes. Floats and doubles in the generated metadata are now trimmed to four
decimal places. Time now explicitly has units of milliseconds (but it's a
double also, so its precision should still be sufficient), and X/Y stages now
have units of micrometers (which is what Micro-Manager calls for in the
device adapter implementation). Stages don't have any explicit units, since our
rotation axis theta is implemented as a stage and I can't really guess at the
units.

Covered everything in glue. (Minor UI improvements.)

Swing has a habit of trying to fill up all available space no matter what, but
they're nice enough to provide 'glue' (invisible, any-sized component) to fill
the gaps. I added some. I also made Select Devices singular, since the one
button affects both the N-Dim sliders tab and the table tab (Though it might be
a bit confusing, since the SPIM tab is the first one to open. Needs review.).

Removed unnecessarily-specific Vector<?> type usages with List<?>.

As I understand it, this is the way Java's collections are meant to be used --
lists are lists, nevermind how the computer is storing and manipulating the
elements.

Began implementing "Insert Discrete Values" functionality (tabular only).

A more powerful way to input rows into the table; it parses MATLAB-style ranges
or square-bracketed arrays (any number in any combination) into a series of
values for each selected device. These rows don't cascade, so (with
considerable patience) any values can be put into the sequence.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Fixed some exceptions caused by my (overzealous) Vector->List conversion.

A few of the changes I made caused some runtime exceptions to be thrown which I
didn't catch earlier. I've corrected them.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Fixed some image data conversion exceptions due to incorrect array types.

Micro-Manager apparently returns 32+ bit image data as an array of bytes (in
contrast to 16-bit, which is returned as a short[], and 8-bit, for which an
array of bytes is precisely what we want). My initial bToI function was not
only insufficient for floats/doubles, it was incorrect in its byte ordering.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Fixed trying to add values to the table when the user cancelled the add dialog.

The window listeners being attached to tabular data entry dialogs weren't
checking to see if the values returned from the dialogs were null or not, so
they were trying to add from null collections.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added support to discrete value entry for repeating a value n times.

I realized that there was no good way to keep one device at the same value for
each step (short of not including it in the list), so I added that ability via
repetition braces: {value, repeat count}.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Various cleanup tasks in ProgrammaticAcquisitor.

Removed performAndShowAcq (static method). It's probably best if other plugins
making use of this code create their own thread for it -- avoids a bulky
listener class for callbacks and a few other irritations. Also updated some
javadoc and in-code comments here and there.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Modified performAcquisition to indicate time dimension and open as hyperstack.

performAcquisition is taking multi-dimensional data; it follows that it should
let ImageJ *know* that the data is multi-dimensional. It now specifies the time
dimension as the number of frames, though multiple X/Y positions are indicated
along with Z positions as slices. (Separating these would require making the
method more aware of the actions it is performing; it really shouldn't have any
more idea than it does already.)

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Modified waiting approaches in performAcquisition to be less cumbersome.

I removed the (mostly useless) waitEach parameter from the method, replacing it
with Micro-Manager's built-in waitForImageSynchro() method.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added device timeout override to ProgAcq

Moving our stage from minimum to maximum values takes too long, and MM
times out waiting for it. So I added a box to override that value.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Start merging ProgAcq parts into SPIMAcquisition

I've started moving the SPIM tab of ProgAcq into the SPIMAcquisition
plugin, per mantis 00000010. It's haphazard, and not really melded quite
yet, but it's a start. :)

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

[00000034] Add continuous acquisition to ProgAcq.

ProgAcq now supports continuous acquisition. Sort-of. The framerate could
be better, likely a result of using snapImage without a circular buffer?
This needs to be investigated before the ticket can be closed.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Fix several issues with labels on RangeSliders.

I also moved the step size slider down underneath the other two sliders,
so it's not quite so cramped.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Changed ProgAcq to accept a parameter wrapper

Before it got *really* messy...

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added ability to save captured images individually.

Still needs testing.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Changed timelapse interval to be in seconds.

In hindsight, milliseconds is really improbable. Still, the time can
probably be entered as a double, so if you need sub-second time lapses, it
should still be possible.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added list-of-positions acquisition tab.

It's a bit messy yet, and the layout issues plaguing the table frustrate
me to no end, but there it is...

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Corrected metadata setting; should hopefully work.

Was accidentally setting the property to an object instead of a string.
Whoops.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added precise name control for individual files...

...when saving individual images through ProgAcq. Users can specify a
naming scheme with %t meaning time and %n being the nth device in the
device list. Might be cumbersome. Not tested!

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Reworked ProgAcq to handle output in a modular way

In order to better facilitate things like writing OME-TIFF files (without
sacrificing the ability to acquire images very simply), I moved the output
handling into two classes which implement an overarching interface. The
acquisition code now calls a function inside said classes which handles
the tagged and wrapped image data neatly.

With these changes in place, all I have to do is add a new class to write
out OME-TIFF files and pass the acquisition that class (with a few
parameters to help it along).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Beginning implementation of OME-TIFF handler

Blehhhh hax

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

OME-TIFF handler multidimensional-capable patch 1

Probably of 2. It's almost done, but I can only seem to convince it to
save the last N images; the remaining images are wiped out, though their
metadata persists.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

OME-TIFF handler writes stacks to separate files

There wasn't a good way to write all the stacks -- which might have
varying sizes -- to the same image file; they're now split up and put into
the directory the user gives, named with first a number, followed by the
X/Y stage positions, followed by the angle -- this may need revision or
flexibility.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Fix build paths of the Ant projects

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

The 'build' Ant targets all depend on 'compile'

Before building the .jar files, the .java files better be compiled...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

ProgAcq: automatically switch off live mode during acquisition

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Modified ProgAcq to better understand stacks

Also hid some of the dirt from the user -- there's probably quite a few
changes to be made yet; I'd like to eventually replace rows of strings
with a StepRow class or the like, to better describe the steps to be
taken. Also, there's probably some unsafe things going on that I'll need
to track down shortly, but pushing this out was a bit of an emergency.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Began implementing AcqRows to update ProgAcq

So now we can do fancier stuff like combat drift, et cetera. It's not
entirely tested yet, so be careful while using it! (The SPIM Ranges tab
definitely works; I tested the position list early, but not recently, so
it might not be functional. Careful with it!)

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

OME Tiff writing: support 8-bit images, too

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Removed old steps approach to AcqParams.

The old List<String[]> option no longer exists; we have to use AcqRow[]
now (it includes useful stuff for stacks and such.).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

First implementation of anti-drift

See comment on issue 78(?) regarding my plan. There's some bugs with it --
possible exceptions during acquisition, I believe -- but I'll be working
them out.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Revisions to OMETIFFHandler

Almost supports things properly, now...

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

ProgAcq: Added X/Y motor velocity; tweaked anti-drift

So it turns out part of the jitter was probably the X/Y motors still
running at speed 10. Since we didn't have properties to control their
speeds, I added two (daringly, I don't cache their values, but pull them
from and push them to the motors directly). I then tweaked the anti-drift
code to store and restore these speeds as well.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Heavy modifications to output handlers

Added a beginStack method (since it was basically being put into
finalizeStack instead), heavily revamped OMETIFFHandler (lumped into the
same commit because of some modifications with AcqRow).

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added (temporary?) mock OME-TIFF writing

For testing, so we can figure out what we're doing wrong with the OME-TIFF
api...

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Further revisions to OME-TIFF handler.

I can't seem to win.

If I explicity specify the plane count, it gets overwritten by the value
1. See OMETiffWriter.java:289. I take this to mean each TiffData should
only have one plane specified in it (despite a PlaneCount parameter?).
Worth noting is that if I correct the plane count in this case, the images
are imported correctly.

If I attempt to follow the guideline given there -- i.e. one plane per
TiffData -- all TiffData elements past the first in each Image element have an
incorrect UUID (I suspect my decided-upon UUID is replaced anyway, but in
the first case, there's only one TiffData element, so it's replaced
_correctly_.). See OMETiffWriter:342.

If I remove the UUID value setting and rely on the writer
to handle it for me (as the fixup to this commit will be written to do),
the second time point for each angle (i.e. the sixth TiffData element,
given a dataset produced by OMETIFFHandler's main()) is missing a new UUID
for its new filename (contrary to the way I interpreted the source code;
not sure why yet!).

Essentially, bio-formats seems intent on being as helpful as possible,
whether I want it to be or not. ;)

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Fixed bugs with sweep rows

Note: Sweeps can't actually be inserted yet. It's one of those weird
hidden functionalities that I'm still debating whether or not to keep.

Firstly, the velociy should be saved and reset once done. Secondly, I
explicity ignore anti-drift settings now for sweeps.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

[0000080] Added 'video' capability

In this mode, the plugin just dumps images as quickly as it can to a
temporary directory. When you press stop, it uses IJ to turn them into one
big stack. This will hopefully wind up being updated with metadata written
to an OME-TIFF.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

[0000078] Tried to squish the GUI down a bit.

I forced the table to shrink somewhat -- it was pushing the height another
fifty pixels or so -- but the effect isn't huge...

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Extended motor range to be from 0 to 8000 (incl)

The motors actually support position 0 -- I think the only reason we roped
it off was the sticking troubles Dresden was having, but I think some
other changes I've made might wrap that up.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>
Merge ProgAcq into SPIMAcquisition

By this point, ProgAcq having its own plugin is a bit of a moot point.
It's pretty heavily integrated into SPIMAcquisition; it makes more sense
for these to be a single plugin.

I've stripped ProgAcq down to just its acquisition code (no more
GUI/plugin code) and moved it into a subpackage of spim.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Started work on a better pixel-size calibration.

It tries to fit to grid lines and determine the precise distance between.
The fitting needs significant tweaking, and the results are not yet
applied to MM, but the rest should serve.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Refactored anti-drift for easier testing/changing

I've pulled all the anti-drift code into a separate class which is now
used. It also is a completely different implementation adjusting based on
each previous stack, so we don't need to take each stack twice.

It does, however, have a serious issue: in the live tests, the
measurements tend to jump out of control; Z in particular oscillates
between positive and negative while its amplitude grows. I believe this to
be a logical mistake somewhere; I'm working on tracking it down.

Additionally, the background subtraction at the moment is a bit shady. I'm
using the max/min properties of ImageProcessor during each frame to pull
out that slice's unique background (though the code is a single
coefficient away from using an overall background subtraction). It seems
to be causing unusual results, which I'll be testing shortly.

A particular advantage of this new implementation is that we can use e.g.
Beanshell to test it on arbitrary stacks. This will let me develop and
refine it far more quickly than before.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Massive upgrades to acquisition

I can't even explain them all here. I enabled all kinds of new settings
and fixed a few bugs along the way.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Add a simple GUI to be used in the interactive anti-drift

This simple GUI shows the XY, XZ and ZY projections of two stacks
as magenta/green overlay.

Cursor up/down/left/right and PageUp/PageDown control the
three-dimensional shift.

Hitting the Return key will call a single callback function and close
the GUI.

The main() method demonstrates how this class should be used. It runs in
the Fiji Script Editor and expects the Fly Brain to be loaded from
File>Open Samples and then split via Image>Color>Split Channels...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Overhauled anti-drift

Now offers various modes, using an interface/factory approach. Anti-drift
will likely soon shift to a callback-based approach altering the
acquisition rows instead of calculating an offset.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Convert DOS line endings to standard ones

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Remove obsolete file

It was copied rather than moved.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Add z-scaling to the interactive anti-drift display

For the moment, the z-scaling is hardcoded since this developer did not
know where to get it from.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

More overhauls to anti-drift and acquisition

Lot to name. ProjDiffAntiDrift is now the de-facto method; it combines
user-controlled three-perspective manual correction with
average-projection phase correlation (wow, that sounded a lot like a sales
pitch!). The test is still underway. OME-TIFFs got a few fixes -- theta is
now stored, and the whole 'plane index n should be < n' thing is also
gone.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Improved status reporting

Now shows which timepoint/angle pair you're on, as well as the progress in
percent.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Further updates to anti-drift

Refactored here and there, fixed some file saving issues.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Rebuilt anti-drift to permanently apply offsets

Also, callbacks.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Removed MM-image-to-image-processor routines

I don't think I realized at the time that Micro-Manager had its own
functions for this -- and they're probably more reliable than mine anyway.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Removed some unused imports

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Removed RunTos

The RunTos were responsible for some deadlock issues -- specifically, for
the X/Y motors, since they were coupled as a single XY Stage device,
telling one to go to a location and the other to move while the first is
in motion, the persistent nature of the RunTos would cause both sliders to
cease responding.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Moved most acquisition responsibility to ProgAcq

The only thing left over in SPIMAcquisition is the movie recording.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Improved video recording mode

Time isn't stamped on the image any more; now that IJ saves slice labels
correctly, an extension of VirtualStack supporting labels is used.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

First version of asynchronous output

I know I pushed it to milestone 2 on the bugtracker, but I think these
results are pretty convincing of its necessity:

100 slices per view:
1 view, 1 timepoint, synchronous: 39.188s total, 24.559s writing (63%)
1 view, 1 timepoint, asycnhronous: 22.485s total, 6.820s writing (30%)
4 views, 4 timepoints, synchronous: 617.865s total, 392.188s writing (63%)
4 views, 4 timepoints, asynchronous: 334.638s total, 96.014s writing (29%)

As you can see, asynchronous writing has nearly halved the time required
to record images. The wrapper is simple and can be applied to
(theoretically) any output handler we develop in the future.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Stability improvements for OME TIFF handler

Until the scifio writer class is updated, these will have to do.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Specify better ranges for stage controls

The X and Y sliders tend to fall more into the middle range of 1000 - 5000
than 500 - 2500; I've altered their default 'limit range' values.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Added SPIM setup/device manager

It may not seem too useful now, but there's inconsistent usage of device
labels throughout SPIMAcquisition and ProgrammaticAcquisitor; this is
intended to remedy that by providing an authoritative source for the
device labels. Additionally, the manager already supports multiple setups
in a single MM instance.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Rebuilt acquisition model using device manager

Huge change. This touches basically every file involved in progacq, but I
think it's worth it.

So, what changed? It's probably easiest to start with the StepTableModel:
it now describes a table of AcqRows, not String[]s (ick!). This cleans up
the pre-acquisition setup (no converting rows; we just borrow the
list...).

Accordingly, AcqRow now uses the DeviceManager's device enum to map
devices to their 'positions'. This also eliminates some nasty
stringification (the positions are stored as doubles now...).

This led to a tangential change in the ProjDiffAntiDrift (just to adapt to
some changes in method names).

AcqParams also needed to change in order to carry a DeviceManager to
ProgrammaticAcquisitor (so it can look up these device labels).

Obviously, this means that ProgrammaticAcquisitor had to change. Most of
these are pretty tame changes, just sorta hacking the new way of referring
to devices into the code -- it's not very pretty (the DeviceManager gets
passed around a lot now...), but it lets me refer to specific devices of a
setup in a general way (i.e. 'send the Z-stage to some-coordinate', or
'get the position of the theta-stage').

Finally, of course, SPIMAcquisition needed some changing also. The
aforementioned pre-acquisition cleanup, mostly.

The drift correction now propagates back to the position list. This is a
consequence of the same AcqRow's modifying themselves to correct for
drift. I personally regard this as a plus -- if you need to reset the
acquisition, any initial manual correction and any subsequent drift
corrections will already be applied to the positions. If it really needs
to change, we only need to deep-copy the AcqRows.

So yes, a lot of changes with no visible difference, but I'm confident it
will have its advantages.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Fixed some OME-TIFF metadata *fixme:zstep*

I misunderstood some of the metadata parameters. Note: this change
involves a hardcoded Z multiplier of 1.5 um/step -- until we determine a
correct value and alter the stage DAL, this multiplier should remain.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>

Display changes for DeviceManager & AcqRow

Renamed 'rotator' to 'theta stage' so it makes sense in the columns of the
table, and limited decimal places to 3 when stringifying the position
range.

Signed-off-by: Luke Stuyvenberg <stuyvenberg@wisc.edu>