We're Hiring!

Bioformats and MicroManger

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Bioformats and MicroManger

Postby i.munro » Mon Nov 24, 2014 12:34 pm

Hi All

I have written a couple of java classes that use bio-formats to save data as ome-tiff
see https://github.com/imunro/FileWriteSPW.

We are currently trying to integrate these into Micro-Manager (MM) acquisition software.
The problem is that MM uses an old version of bio-formats (sufficiently old to be the old name of scifio.jar).

NB We received the following from the MM team :

"The version in MM is most certainly outdated. As far as I know, there is
no particular reason why we need the old version, but updating it would
certainly require careful checking to make sure nothing breaks. It's use
in Micro-Manager is limited to the writing of OME-XML metadata when
writing the (standard) image stack file format."

We don't really have the bandwidth to update MM to the newer bio-formats and then maintain our own version.

The Java classes in question use a limited number of components from bioformats_package.jar (included below)
Can anyone tell me which components within bioformats_package.jar are required and whether those components will still clash with scifio.jar or ,even better,can anyone suggest an easier solution.

Many thanks

Ian

import loci.common.services.DependencyException;
import loci.common.services.ServiceException;
import loci.common.services.ServiceFactory;
import loci.formats.CoreMetadata;
import loci.formats.FormatException;
import loci.formats.FormatTools;
import loci.formats.ImageWriter;
import loci.formats.meta.IMetadata;
import loci.formats.ome.OMEXMLMetadata;
import loci.formats.services.OMEXMLService;
import loci.formats.MetadataTools;
import loci.common.DataTools;

import ome.xml.model.enums.DimensionOrder;
import ome.xml.model.enums.EnumerationException;
import ome.xml.model.enums.PixelType;
import ome.xml.model.primitives.PositiveInteger;
import ome.xml.model.primitives.NonNegativeInteger;
import ome.xml.model.enums.NamingConvention;
i.munro
 
Posts: 50
Joined: Thu Apr 25, 2013 1:01 pm

Re: Bioformats and MicroManger

Postby bramalingam » Tue Nov 25, 2014 4:48 pm

Hi Ian,

Here's an independent test which works (aka : Uses Bioformats_package (5.0.6) and exports images snapped from Micromanager as ome-tiff).

I have included the acquisition angle as well to cover the complete workflow (and am guessing that you're problem might be more at the acquisition side of things). There are multiple methods to snap images in micromanager, so am just attaching the script that worked for me.

Code: Select all
   
%Import packages
import org.micromanager.MMStudioMainFrame;
import org.micromanager.acquisition.AcquisitionWrapperEngine;
import ij.*;
import ij.io.FileSaver;
import org.micromanager.utils.ImageUtils;
import ij.process.ImageProcessor;
import ij.ImagePlus;
import org.micromanager.api.Autofocus;
import ij.text.TextCanvas;
import org.micromanager.plugin.*;
import loci.plugins.out.Exporter;
   
gui = MMStudioMainFrame(false);
f = warndlg('Press ok once config file is loaded', 'Note');
gui.show;
drawnow;waitfor(f);

mmc = gui.getCore;
mmc.loadSystemConfiguration ('/Applications/Micro-Manager1.4/MMConfig_demo.cfg');

%parameters
exposures = [0,10,100,1000];       
config_groups=mmc.getAvailableConfigGroups();
channels=mmc.getAvailableConfigs(config_groups.get(1));
%Image Output Directory and Suffix for Image Name
acqRoot = [pwd '/'];
AcqName = 'Test_Config';
numFrames = 10;
numSlices =1 ;

gui.openAcquisition(AcqName, acqRoot, numFrames, length(channels), numSlices);

for i=1:channels.size
    gui.setChannelName(BrightAcqName, i-1, char(channels.get(i-1)));
end

plugin = loci.plugins.LociExporter();

for i=0:numFrames-1
            for j=1:channels.size
                mmc.setConfig(config_groups.get(1), char(channels.get(j-1)));
                mmc.setExposure(exposures(j));
                mmc.snapImage();
               
                img = mmc.getImage();  % returned as a 1D array of signed integers in row-major order
               
                width = mmc.getImageWidth();
                height = mmc.getImageHeight();
               
                %Saving image
                proc0 = ImageUtils.makeProcessor(mmc, img);
                imgp0 = ImagePlus('',proc0);
                if i==0
                    gui.displayImage(img);   
                    image = IJ.getImage();
                    exporter = loci.plugins.out.Exporter(plugin, image);
                   
                    exporter.run();
                    keyboard
                end
          end               

           
end


Plus here's my class path,
    Users/bramalingam/Downloads/bfmatlab-17/bioformats_package.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/trident.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/swingx-0.9.5.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/swing-layout-1.0.4.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/substance.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/slf4j-api-1.7.1.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/scifio.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/rsyntaxtextarea.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/ome-xml.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/miglayout-4.0-swing.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/lwm.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/loci-common.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/jfreechart-1.0.13.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/jcommon-1.0.16.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/gson-2.2.4.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/gproto.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/data.json.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/core.memoize.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/core.cache.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/commons-math-2.0.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/clooj.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/clojure.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/bsh-2.0b4.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/TSFProto.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/MMJ_.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/MMCoreJ.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/MMAcqEngine.jar
    /Applications/Micro-Manager1.4/plugins/Micro-Manager/AbsoluteLayout.jar
    /Applications/Micro-Manager1.4/plugins/bioformats_package.jar
    /Applications/Micro-Manager1.4/plugins/Volume_Viewer.jar
    /Applications/Micro-Manager1.4/mmplugins/Obsolete/BFCorrector.jar
    /Applications/Micro-Manager1.4/mmplugins/Image_Processing/SplitView.jar
    /Applications/Micro-Manager1.4/mmplugins/Image_Processing/NewImageFlipper.jar
    /Applications/Micro-Manager1.4/mmplugins/Image_Processing/MultiChannelShading.jar
    /Applications/Micro-Manager1.4/mmplugins/Device_Control/pgFocus.jar
    /Applications/Micro-Manager1.4/mmplugins/Device_Control/autolase.jar
    /Applications/Micro-Manager1.4/mmplugins/Device_Control/StageControl.jar
    /Applications/Micro-Manager1.4/mmplugins/Device_Control/Projector.jar
    /Applications/Micro-Manager1.4/mmplugins/Device_Control/MultiCamera.jar
    /Applications/Micro-Manager1.4/mmplugins/Device_Control/CRISP.jar
    /Applications/Micro-Manager1.4/mmplugins/Device_Control/ASIdiSPIM.jar
    /Applications/Micro-Manager1.4/mmplugins/Developer_Tools/ClojureEditor.jar
    /Applications/Micro-Manager1.4/mmplugins/Beta/PixelCalibrator.jar
    /Applications/Micro-Manager1.4/mmplugins/Acquisition_Tools/SlideExplorer.jar
    /Applications/Micro-Manager1.4/mmplugins/Acquisition_Tools/MMTracker.jar
    /Applications/Micro-Manager1.4/mmplugins/Acquisition_Tools/IntelligentAcquisition.jar
    /Applications/Micro-Manager1.4/mmplugins/Acquisition_Tools/HCS.jar
    /Applications/Micro-Manager1.4/mmplugins/Acquisition_Tools/Gaussian.jar
    /Applications/Micro-Manager1.4/mmplugins/Acquisition_Tools/AcquireMultipleRegions.jar
    /Applications/Micro-Manager1.4/mmplugins/RecallPlugin.jar
    /Applications/Micro-Manager1.4/mmplugins/DataBrowser.jar
    /Applications/Micro-Manager1.4/mmplugins/Big.jar
    /Applications/Micro-Manager1.4/mmautofocus/MMOughtaFocus.jar
    /Applications/Micro-Manager1.4/mmautofocus/MMAutofocusTB.jar
    /Applications/Micro-Manager1.4/mmautofocus/MMAutofocusDuo.jar
    /Applications/Micro-Manager1.4/mmautofocus/MMAutofocus.jar
    /Applications/Micro-Manager1.4/ij.jar

Which contains both Bioformats_package(5.0.6) and the jars packaged within micromanager.

The above example uses the bioformats_exporter plugin to export images as ome-tiff's. Similarly, your SPWwriter should also not face any conflicts while exporting, if the acquisition side of things are picked properly.

Please let me know if this doesnt makes sense.

Best,
Balaji
User avatar
bramalingam
 
Posts: 70
Joined: Tue Jan 14, 2014 12:01 pm

Re: Bioformats and MicroManger

Postby i.munro » Tue Nov 25, 2014 4:51 pm

Thanks for all your efforts Balaji

Ian
i.munro
 
Posts: 50
Joined: Thu Apr 25, 2013 1:01 pm


Return to Developer Discussion

Who is online

Users browsing this forum: Google [Bot] and 0 guests