Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
software:fiji_mvr [2015/10/07 20:41]
Jon Daniels
software:fiji_mvr [2019/07/16 20:50]
Jon Daniels added script
Line 6: Line 6:
  
 As of April 2015 the MVR plugin allows for direct importing of Micro-Manager datasets.  Previously the Micro-Manager plugin's export function was used (it is still required for [[MIPAV GenerateFusion]]). As of April 2015 the MVR plugin allows for direct importing of Micro-Manager datasets.  Previously the Micro-Manager plugin's export function was used (it is still required for [[MIPAV GenerateFusion]]).
 +
 +
 +==== Fiji MVR scripts ====
 +
 +This script was used during the 2018 EMBO Practical Course for Light sheet microscopy in Dresden to roughly align two views collected on the ct-dSPIM:
 +
 +<code groovy>
 +
 +#@File (label="Freshly loaded BDV XML File Location") xml_file
 +
 +/** 
 +  Simple script to deskew, flip and move a DiSPIM dataset
 + *  
 +  Olivier BURRI, Jon Daniels
 +  EMBO Lightsheet Course 2018
 + *  
 +  INPUT: XML file which contains two angles named 0 and 90
 + *  
 +  This will apply the transformations to the XML file and reopen the multiview applications
 + *  
 +  Last modification: August 8 2018
 + */
 +import groovy.util.XmlSlurper
 +import ij.IJ
 +
 +def meta = new XmlSlurper().parse( xml_file )
 +//def size = meta.SpimData.SequenceDescription.ViewSetups.ViewSetup.sizexml_file
 +def size = meta.SequenceDescription.ViewSetups.ViewSetup.size[0] as String
 +
 +def dimensions = size.tokenize(" ");
 +def width  = dimensions[0] as double
 +def height = dimensions[1] as double
 +def depth  = dimensions[2] as double
 +
 +println("Width: "+width)
 +println("Height: "+height)
 +println("Depth: "+depth)
 +
 +def deskew = "1.0, 0.0, -1.0, 0.0, "+
 + "0.0, 1.0, 0.0, 0.0, "+
 + "0.0, 0.0, 1.0, 0.0"
 +
 +println(deskew)
 +
 +def flip  =  "0.0, 0.0, -1.0, 0.0, "+
 + "0.0, -1.0, 0.0, 0.0, "+
 + "-1.0, 0.0, 0.0, 0.0"
 +
 +def trans =  "1.0, 0.0, 0.0, "+(height/2)+", "+
 + "0.0, 1.0, 0.0, "+(width)+", "+
 + "0.0, 0.0, 1.0, "+depth
 +
 +// Return to calibration only, if necessary
 +IJ.run("Apply Transformations", "select=["+xml_file.getAbsolutePath()+"] "+
 + "apply_to_angle=[All angles] apply_to_channel=[All channels] apply_to_illumination=[All illuminations] apply_to_tile=[All tiles] apply_to_timepoint=[All Timepoints] "+
 + "transformation=[Identity (no transformation)] "+
 + "apply=[Calibration (removes any existing transforms)] "
 + "same_transformation_for_all_angles");
 +
 +// Apply deskew to all angles
 +IJ.run("Apply Transformations", "select=["+xml_file.getAbsolutePath()+"] "+
 + "apply_to_angle=[All angles] apply_to_channel=[All channels] apply_to_illumination=[All illuminations] apply_to_tile=[All tiles] apply_to_timepoint=[All Timepoints] "+
 + "transformation=Affine apply=[Current view transformations (appends to current transforms)] "+
 + "same_transformation_for_all_angles "+
 + "timepoint_0_channel_0_illumination_0_all_angles=["+deskew+"]");
 +
 +// Apply Flip to angle 90
 +IJ.run("Apply Transformations", "select=["+xml_file.getAbsolutePath()+"] "+
 + "apply_to_angle=[Single angle (Select from List)] apply_to_channel=[All channels] apply_to_illumination=[All illuminations] apply_to_tile=[All tiles] apply_to_timepoint=[All Timepoints] "+
 + "processing_angle=[angle 90] "+
 + "transformation=Affine apply=[Current view transformations (appends to current transforms)] "+
 + ""+
 + "timepoint_0_channel_0_illumination_0_angle_90=["+flip+"]");
 +  
 +// Aplly Rough translation to angle 90
 +IJ.run("Apply Transformations", "select=["+xml_file.getAbsolutePath()+"] "
 + "apply_to_angle=[Single angle (Select from List)] apply_to_channel=[All channels] apply_to_illumination=[All illuminations] apply_to_tile=[All tiles] apply_to_timepoint=[All Timepoints] "+
 + "processing_angle=[angle 90] "+
 + "transformation=Affine apply=[Current view transformations (appends to current transforms)] "+
 + ""+
 + "timepoint_0_channel_0_illumination_0_angle_90=["+trans+"]");
 +
 +// Open MultiView Application
 +IJ.run("MultiView Reconstruction Application", "select_xml=["+xml_file.getAbsolutePath()+"]");
 +
 +</code>