User Tools

Site Tools


Sidebar

Top
Seminar
Courses
Textbooks
Documents
Downloads (-2016)
Downloads (2016-)
Weblog
RSS aggregates
Discussions
Archives


EMBL BioImage Data Analysis

EuBIAS

NEUBIAS

—- Contact
CMCI Alumni
ALMF
EMBL Heidelberg
EMBL Intranet


Popularity Ranking


Timeline of @cmci_

cmci_ avatar

Impressive and swift moderation @helenajambor !
About 3 hours, 33 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

RT @LuisDVerde: Now available as a #ggplot2 geom thanks to @naupakaz https://t.co/zOaMWvzd8k https://t.co/AXYBCeGyw6
About 3 hours, 36 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

RT @helenajambor: awesome, within 2 days .@naupakaz made a code publicly available for anyone wanting to make the half-and-half-plot FYI @…
About 3 hours, 37 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

RT @dgaboriau: Thread on data visualisation: ggplots, boxplots and violin plots https://t.co/QZE7xQtaa3
About 9 hours, 14 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

RT @christlet: SUSHI from Valentin Nāgerl lab allows super-resolution microscopy of neuronal morphology by STED imaging of extracellular sp…
About 12 hours, 24 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

RT @christlet: Our work with @HenriquesLab and @MercerLab on SQUIRREL highlighted on the @CNRS website (in French, and we even found a pun!…
About 12 hours, 25 mins ago by: Kota Miura (@cmci_)
blogtng:blogtop
Algorithm FRAP Fiji ImageJ ImageJ Plugin ImageJ Plugin 3Dviewer Imaris Java Javascript Python R bias blog dokuwiki fiji google imagej java libraries matlab meetings neubias news papers python references software webadmin




CMCI weblog

ImageJ Plugin Export Hyperstack to Imaris

A new ImageJ plugin bridging data from ImageJ to Imaris is now ready . It should be pretty useful for the visualization of multidimensional data while you are analyzing images in IJ.

Coding memo for JACOB Bridge between Java and Bitplane Imaris

In addition to the previous page (http://cmci.embl.de/blogtng/2010-06-17/imaris_-_java), here is a list of commands for JACOB bridge for Java and Imaris.

- To get an Instance of Imaris

ActiveXComponent imarisApplication = new ActiveXComponent("Imaris.Application");

- General syntax for getting/setting field values of IApplication getter:

imarisApplication.getProperty("FIELD_VALUE", PARAMETER);

setter:

imarisApplication.setProperty("FIELD_VALUE", PARAMETER);

- To keep Imaris opened (otherwise closes after operation)

imarisApplication.setProperty("mUserControl", true);

- To get an Instance of Imaris data

ActiveXComponent IDataSet = imarisApplication.getPropertyAsComponent("mDataSet");

- Creating new data in Imaris (empty)

...
Variant[] parameter = new Variant[6];
int ijXsize = imagestack.getWidth();
int ijYsize = imagestack.getHeight();
int ijnSlices = imagestack.getSize();
parameter[0] = new Variant(1);	//1 for type 8bit 
parameter[1] = new Variant(ijXsize);	//x
parameter[2] = new Variant(ijYsize);	//y
parameter[3] = new Variant(ijnSlices);  //z
parameter[4] = new Variant(1);			//channel
parameter[5] = new Variant(1);			//time point
IDataSet.invoke("Create", parameter);	

- getting data parameter from Imaris (data shown in Imaris). An example with image size in x

int imXsize = localIDataSet.getProperty("mSizeX").changeType(Variant.VariantInt).getInt();

Writing Matlab code for ImarisXT

Getting Imaris object is pretty similar (see previous notes).

Found several links besides Bitplane site.

Aaron Christian Pontis Qu http://www.scs2.net/home/index.php?option=com_content&view=article&id=46:qu-for-matlab&catid=34:qu&Itemid=55&showall=1

Pretty much of communication with Imaris.

  • Sending 4D stack (successful with 8 z-slices, 46 timepoints tiff hyperstack)
  • Retrieving spots detected in Imaris back to matlab (I waited 5 minutes but currently not responding… finally, I got all the spots, none-filtered. It took time probably because I did not filter).

How to write Matlab Code for ImarisXT: a Short Tutorial http://sybil.ece.ucsb.edu/pages/imarisxt.html

this is a bit outdated.


I will further try doing something like

  • set parameters for spot detection from Matlab or Java
  • do spot analysis in Imaris using above setting
  • fetch the results of detected spots from Imaris to Matlab or Java
  • evaluate the quality. Change spot detecton parameter
  • do spot analysis again with updated parameter.
  • this looping goes on until certain satisfactory value is achieved, walk through parameter space.

For this, image stack itself stays in Imaris. Only parameter setting is exported from java/matlab to imaris, and analysis results are thrown back to matlab/java.

Imaris - Java

Here is some notes on accessing Imaris contents from Java. Since this example uses COM interface via jacob.dll, platform is limited to windows.

Setup

There is a breif description in http://www.bitplane.com/go/products/imarisxt

In order to run the JACOB demo, the Java COM Bridge needs to be installed (put the jacob.dll into /bin and the jacob.jar into /lib/ext). The demo does similar things like the demos above: Start Imaris, load a Dataset, perform some action with the image, and terminate Imaris. Many thanks for providing the source code to Volker Bäcker, Monpellier RIO Imaging.

So accessing Imaris from Java requires Jacob pakage (Java - COM Bridge, http://sourceforge.net/projects/jacob-project/). When I downloaded the latest version, two .dll files were included in the package and no jacob.dll.

Jacob.jar relies on a DLL file that it loads off of the library path or classpath. This means that you must either copy the appropriate jacob ddll into your path or use VM options to add directory holding jacob dll to the path. Prior to 1.14M6, the jacob DLL name was alwasy “jacob.dll”. This made it hard to verify jacob was loading the correct dll when multiple copies of jacob were installed on a single system. It also was confusing on 64 bit systems where the 32 bit and 64 bit dlls have the same tames. Starting in 1.14M6, Jacob's library loader selects a dll with the appropriate name based on the jacob release and platform. The dll naming convention is: jacob..dll

There actually are following two .dll files in the package.

  • jacob-1.15-M3-x64.dll
  • jacob-1.15-M3-x86.dll

I copied them under C:\Sun\SDK\jdk\jre\bin, where my system PATH is already set.

jacob.jar was as it is so this was copied under C:\Sun\SDK\jdk\jre\lib\ext

Testing java applicaiton using example downloadable from Bitplane

Example java code by Volker Bäcker is available in the Bitplane site linked above. I downloaded the java file and then made it testable in Eclipse (simply add jacob.jar file in the project build path).

Start button: starts up Imaris

Starting up of imaris uses ActiveX control. Useful tool for viewing ActiveX control: checking progID (activeXID). http://www.nirsoft.net/utils/axhelper.html

Constructor of imaris class instance is as follows, within getStartImarisButton().

	public void actionPerformed(java.awt.event.ActionEvent e) {
		if (imarisApplication == null) {
			imarisApplication = new ActiveXComponent("Imaris.Application");
			imarisApplication.setProperty("mVisible", true);
		}
	}

“mVisible” is a property of IApplication Interface and details are in: http://www.bitplane.com/products/imarisxt/doc/interfaceIApplication.html#6dd1946c64e40cac3f7ca33fc85e520c

ActiveXComponent is a class provided in Jacob package, and accessing Imaris functions are mostly done through the method of this class. Java doc is at: http://www.jarvana.com/jarvana/view/net/sf/jacob-project/jacob/1.14.3/jacob-1.14.3-javadoc.jar!/api/com/jacob/activeX/ActiveXComponent.html

text field & "Load" button (first and second line)

Load button sends command to Imaris by following three lines in method getLoadImage1Button().

	Variant parameter1 = new Variant(imagePath1TextField.getText());
	Variant parameter2 = new Variant("");
	imarisApplication.invoke("FileOpen",parameter1, parameter2);

imarisapplication is an instance of ActiveXComponent constructed above. Class Variant is described in the Jacob Java doc:

http://www.jarvana.com/jarvana/view/net/sf/jacob-project/jacob/1.14.3/jacob-1.14.3-javadoc.jar!/api/com/jacob/com/Variant.html

“FileOpen” is a member funciton of IApplication Interface and details are in: http://www.bitplane.com/products/imarisxt/doc/interfaceIApplication.html#eef133819f46ccfb4af8a4483990436f

By the way, imarisapplication is initialized in the method “initialize()” as follows:

	private void initialize() {
		this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
		this.setContentPane(getJPanel());
		this.setSize(440, 545);
		this.setTitle("Hello Imaris DataSet");
		this.addWindowListener(new java.awt.event.WindowAdapter() {
			public void windowClosing(java.awt.event.WindowEvent e) {
				if (imarisApplication != null) {
					imarisApplication.setProperty("mUserControl", !checkbox.getState());
				}
			}
		});
	}

details on the IApplication interface property “mUserControl” is in: http://www.bitplane.com/products/imarisxt/doc/interfaceIApplication.html#6caedd58b0c5f2cc2c7e5f03acb1e15f

getSize button

(does not work, returs error in the current state)

Initialization

This button's action is as follows:


	public void actionPerformed(java.awt.event.ActionEvent e) {
		ActiveXComponent dataSet = imarisApplication.getPropertyAsComponent("mDataSet");
		int type = dataSet.getPropertyAsInt("mType");
		typeComboBox.setSelectedIndex(type);
		xTextField.setText(dataSet.getPropertyAsString("mSizeX"));
		yTextField.setText(dataSet.getPropertyAsString("mSizeY"));
		zTextField.setText(dataSet.getPropertyAsString("mSizeZ"));
		chTextField.setText(dataSet.getPropertyAsString("mSizeC"));
		tTextField.setText(dataSet.getPropertyAsString("mSizeT"));
	}

mDataset: IApplicaiton property http://www.bitplane.com/products/imarisxt/doc/interfaceIApplication.html#066c16450138b617b1b031352731fdb3

mSizeX: IDataSet property http://www.bitplane.com/products/imarisxt/doc/interfaceIDataSet.html#5344b4751d9a543ffefcb9c9e0762cc9

ImageJ - ImarisXT-Imaris

I made some tiral using ImageJ and Bitplane Imaris (in Windows). software versions are:

ImageJ: 1.44c, Java 1.6.0_20 32 bit
Imaris 7.0.0.

To use ImageJ along with Imaris, install ImageJ plugin from Bitplane as they instruct in Bitplane website. Then start up IJ. A small window that looks like below appears:

Imaris Adapter

By clicking “Start/Stop” button, Imaris starts up (same as clicking imaris.exe, but connected to ImageJ via COM). To send image stack opened in ImageJ, simply clcik “Export Data” (which means “Export data shown in ImageJ to Imaris workspace”).

In this way, viewing 3D dataset in ImageJ stack could be viewed more comfortably in Imaris 3D user interface.

One obvious problem I encountered is when I tired to export 4D dataset from ImageJ to Imaris. I opened a 4D dataset with 8 slices (z) and 46 time points. Since ImageJ plugin interface above does have user input for time point, I input the time points number but this was some how not recognized and stack was exported as 368 slices z-stack.

→ Checking through the source code bpImarisAdapter.java“, I realized that exporting from IJ to Imaris is only available with single time point (value you input in the text field is a single time index, not the total time points). For this, 4D sequence (such as hyperstack) should be split into sepatate z-stacks and then exported to Imaris one by one. The method for exporting is

public boolean ExportDataSetToImaris(int aSelectedChannel, int aSelectedTimepoint, boolean aCreateNewImage)

So probably, it will be same for channels: channels should be separated stack.

“Import Data” could pull image shown in Imaris into ImageJ, but “surfaces” constructed in Imaris does not appear (probably the same as above, single time point).

Other comments:

Macro file is available only with .txt extension, but it should also include ”.ijm“, IJmacro extension.

		  if (!vFileName.endsWith(".txt")) {
			// a typical ImageJ macro file ends with .txt!
			IJ.showMessage("ImageJ macros are .txt files.");
			return;
		  }

Macro executer is a method in Adaptor class:

 /**
 * Apply a selected macro to Imaris DataSet
 * 
 * @param aMacroDirectory The folder where the macro is lying
 * 	aMacroFileName The filename of the macro
 * 	aCreateNewChannels true if new channels should be created out of each existing ones
 *      aSelectedChannels if 0 the macro will apply to all channels and timepoints
 * 
 * @return true if success
 */
 public boolean ApplyMacroToWholeDataSet(String aMacroFileName, boolean aCreateNewChannels, int aSelectedChannel)

This method basically import dataset (image in the current window, could include also multiple channels and time points), creates ImagePlus, apply macro, then after processing in IJ, The processed image is exported back into Imaris.

→ plugin would be better with more functionalities to import information such as surface, array of detected spot information, tracks, statistics.. and so on.


Extending the code

  • extend bpImaris_Adapter.java (in my case for sending 4D)
  • jniwrap.jar, bpImaris_Adapter2.jar should be in the build path.
    • latter package is com.bitplane.imaris.imaris.*
  • exporting method (Current image stack in ImageJ to Imaris) is below. Iterate this to export time series.
public boolean ExportDataSetToImaris(int aSelectedChannel, int aSelectedTimepoint, boolean aCreateNewImage) {
...
  • … should check if aCreateNewImage means new image within imaris.

entry generator

Weblog Archive

blogtng/blogtop.txt · Last modified: 2016/05/24 05:46 (external edit)