OPS>SOFTWARE>DOCUMENTATION>EXPORT MICRO-MANAGER METADATA

How to export Micro-Manager Metadata to an Excel spreadsheet

This utilizes the OpenPolScope Software (ver 2.18 build May 30, 2014 or later) and Sub Plugin (Pre/Post Processing) ImageJMacro. This requires ImageJ version to be updated to a minimum of 1.48h to print integer values correctly without conversion.

Export Metadata ImageJ Table

Note: This example assume and applies for Birefringence mode but can be applied to others.

    Export Results Table:
  1. Load the macro under Pol-Analyzer > Processing > ImageJMacro-Pre or Post (If data has not been processed previously use Post only)
  2. If data has already been processed use the 'Walk' feature (Pol-Analyzer > Options > Dont Process)
  3. Open a multi-dimensional Birefringence dataset
  4. Press Play/Walk, the above ImageJ Results window should be created and populated sequentially.
  5. Once process is completed a Results.xls file will be created on the Desktop. Write access is required and file should not be opened in any software at the time of this process. This file is overwritten if it exists.
  6. If the export template file is used it provides import and plot function using a single button. This feature utilizes VB macro.
Downloads are located at the end of the page.

// PostProcessor Macro for Pol-Acquistion / Pol-Analyzer
// requires ImageJ 1.48h
requires("1.48h"); MetadataKeyTime = "ElapsedTime-ms"; // Time key (key tag from Micro-Manager metadata panel) MetadataKeyChName = "Channel"; // Channel key title = getTitle(); // (gets title of the dataset from ImageJ window, alternate method is from metadata) len1=lengthOf(title); len2=lengthOf("_Processing"); if (len1 > len2) { title = substring(title, 0, len1-len2); // (the ImageJMacro method adds '_Processing' when applying the macro and we replace it here) } roiStr = "Not used"; s = selectionType(); if( s == -1 ) { // no selection } else if( s == 10 ) { // point selection } else { getSelectionBounds(x, y, w, h); roiStr = "x="+x+",y="+y+",width="+w+",height="+h; //(gets the ROI selection) } //(custom OpenPolScope methods using Extensions (Ext)) Ext.getChMetadata(0, "Frame", frame); // (get Frame Index) Ext.getChMetadata(0, "Slice", slice); // (get Slice Index) Ext.getChMetadata(0, "PositionIndex", pos); // (get Position Index) dim = "T="+frame+", S="+slice+" ,P="+pos; //(gets Time from last raw image channel and mean value from the computed Retardance image channel) chNumMean = 0; // (0 == Retardance image) Micro-Manager is 0 based chNumTime = 6; // (6 == State4 image) Micro-Manager is 0 based //(from channel 0 using key 'ElapsedTime-ms' get and sets variable 'time1') Ext.getChMetadata(chNumTime, MetadataKeyTime, time1); //(from channel 0 using key 'Channel' get and sets variable 'chN1') Ext.getChMetadata(chNumMean , MetadataKeyChName, chN1); setSlice(chNumMean +1); // imageJ is 1 based so add 1 (sets image to 1) getRawStatistics(area, mean1, min, max, stdev, histogram); // (gets imageJ statistics for 1) //(gets Time from State0 raw image channel and mean value from the State1 image channel) chNumMean = 2; // (2 == State0 image) Micro-Manager is 0 based chNumTime = 2; // (2 == State0 image) Micro-Manager is 0 based Ext.getChMetadata(chNumTime, MetadataKeyTime, time2); Ext.getChMetadata(chNumMean , MetadataKeyChName, chN2); setSlice(chNumMean +1); // imageJ is 1 based so add 1 getRawStatistics(area, mean2, min, max, stdev, histogram); //(gets Time from State1 raw image channel and mean value from the State2 image channel) chNumMean = 3; // (3 == State1 image) Micro-Manager is 0 based chNumTime = 3; // (3 == State1 image) Micro-Manager is 0 based Ext.getChMetadata(chNumTime, MetadataKeyTime, time3); Ext.getChMetadata(chNumMean , MetadataKeyChName, chN3); setSlice(chNumMean +1); // imageJ is 1 based so add 1 getRawStatistics(area, mean3, min, max, stdev, histogram); //(gets Time from State2 raw image channel and mean value from the State3 image channel) chNumMean = 4; // (4 == State2 image) Micro-Manager is 0 based chNumTime = 4; // (4 == State2 image) Micro-Manager is 0 based Ext.getChMetadata(chNumTime, MetadataKeyTime, time4); Ext.getChMetadata(chNumMean , MetadataKeyChName, chN4); setSlice(chNumMean +1); // imageJ is 1 based so add 1 getRawStatistics(area, mean4, min, max, stdev, histogram); //(gets Time from State3 raw image channel and mean value from the State4 image channel) chNumMean = 5; // (5 == State3 image) Micro-Manager is 0 based chNumTime = 5; // (5 == State3 image) Micro-Manager is 0 based Ext.getChMetadata(chNumTime, MetadataKeyTime, time5); Ext.getChMetadata(chNumMean , MetadataKeyChName, chN5); setSlice(chNumMean +1); // imageJ is 1 based so add 1 getRawStatistics(area, mean5, min, max, stdev, histogram); //(gets Time from State4 raw image channel and mean value from the State5 image channel) chNumMean = 6; // (6 == State4 image) Micro-Manager is 0 based chNumTime = 6; // (6 == State4 image) Micro-Manager is 0 based Ext.getChMetadata(chNumTime, MetadataKeyTime, time6); Ext.getChMetadata(chNumMean , MetadataKeyChName, chN6); setSlice(chNumMean +1); // imageJ is 1 based so add 1 getRawStatistics(area, mean6, min, max, stdev, histogram); //(ImageJ Results table creation - common for all channels) row = nResults(); setResult("Dataset", row, title); setResult("Location", row, dim); setResult("ROI", row, roiStr); //(ImageJ Results table creation - image specific info is passed) CreateTable(title, roiStr, chN1, time1, mean1, chN2, time2, mean2, chN3, time3, mean3, chN4, time4, mean4, chN5, time5, mean5, chN6, time6, mean6); //(ImageJ Results table saved to an Excel on the Desktop) homeDir = getDirectory("home") + ("\\Desktop\\Results.xls"); saveAs("Results", homeDir); function CreateTable(title, roiStr, ch1, time1, mean1, ch2, time2, mean2, ch3, time3, mean3, ch4, time4, mean4, ch5, time5, mean5, ch6, time6, mean6) { row = nResults()-1; setResult(ch1 + " Time (ms)", row, time1); setResult(ch1 +" Mean", row, mean1); setResult(ch2 + " Time (ms)", row, time2); setResult(ch2 +" Mean", row, mean2); setResult(ch3 + " Time (ms)", row, time3); setResult(ch3 +" Mean", row, mean3); setResult(ch4 + " Time (ms)", row, time4); setResult(ch4 +" Mean", row, mean4); setResult(ch5 + " Time (ms)", row, time5); setResult(ch5 +" Mean", row, mean5); setResult(ch6 + " Time (ms)", row, time6); setResult(ch6 +" Mean", row, mean6); updateResults(); }

    Excel Plotting Template:
  1. Open the file 'ExportResultsTemplate.xlsm'.
  2. If Excel-VB-macro is disabled by default then a Security Warning will be displayed... click 'Options...'
  3. Select the radio button - Enable this content (applies to this excel file only then)
  4. Click on button 'Copy From Results.xls' - Please make sure Results.xls was exported using the process above
  5. Results will be copied from 'Results.xls' to the Template and the Plot on the 'Plot' sheet updated with new values
  6. It is recommended to save this Template file to a new Excel Workbook (without Excel-VB-macro .xls, .xlsx)
  7. The copy and chart plot function is currently set for upto 200 rows and should be expanded as required in the VB-macro and chart data selection.
Note: It is recommended to enable Excel-VB-macro as required and not permanently via Excel options.

ExportResultsTemplate.xlsm - Plot Export Metadata ImageJ Table

Download the above ImageJ macro for OpenPolScope.
Download the corresponding Excel Template for generating plots (like above) using a single click. (VB Macro Executable file)

© OpenPolScope | All Rights Reserved | Contact
Last Page Update on June 09 2014 15:37