Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
software:fiji_mvr [2015/10/07 20:41] Jon Daniels |
software:fiji_mvr [2019/07/27 18:19] (current) Jon Daniels [Fiji MVR scripts] |
||
---|---|---|---|
Line 6: | Line 6: | ||
As of April 2015 the MVR plugin allows for direct importing of Micro-Manager datasets. | As of April 2015 the MVR plugin allows for direct importing of Micro-Manager datasets. | ||
+ | |||
+ | |||
+ | ==== 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=" | ||
+ | |||
+ | /** | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | */ | ||
+ | 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(" | ||
+ | println(" | ||
+ | println(" | ||
+ | |||
+ | 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, " | ||
+ | "0.0, 1.0, 0.0, " | ||
+ | "0.0, 0.0, 1.0, " | ||
+ | |||
+ | // Return to calibration only, if necessary | ||
+ | IJ.run(" | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | |||
+ | // Apply deskew to all angles | ||
+ | IJ.run(" | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | |||
+ | // Apply Flip to angle 90 | ||
+ | IJ.run(" | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | "" | ||
+ | " | ||
+ | | ||
+ | // Aplly Rough translation to angle 90 | ||
+ | IJ.run(" | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | "" | ||
+ | " | ||
+ | |||
+ | // Open MultiView Application | ||
+ | IJ.run(" | ||
+ | |||
+ | </ | ||
+ | |||
+ | This script did some other pre-processing: | ||
+ | |||
+ | <code groovy> | ||
+ | |||
+ | |||
+ | #@File main_folder (label=" | ||
+ | |||
+ | // Iterate and find all files | ||
+ | import static groovy.io.FileType.FILES | ||
+ | import ij.IJ | ||
+ | import ij.plugin.ChannelSplitter | ||
+ | import ij.io.Opener | ||
+ | |||
+ | import groovyx.gpars.GParsPool | ||
+ | |||
+ | |||
+ | def save_folder = new File(main_folder, | ||
+ | save_folder.mkdir() | ||
+ | |||
+ | |||
+ | def opener = new Opener() | ||
+ | // Find all files. | ||
+ | def all_files = [] | ||
+ | main_folder.eachFile(FILES) { file -> | ||
+ | if(file.getName().endsWith(" | ||
+ | all_files.add(file) | ||
+ | // | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Collections.reverse(all_files) | ||
+ | |||
+ | |||
+ | //all_files = all_files.take(1) | ||
+ | |||
+ | // | ||
+ | // | ||
+ | all_files.each { file -> | ||
+ | //def temp_image = opener.openTiff(file.getParent()+File.separator, | ||
+ | |||
+ | println(" | ||
+ | |||
+ | def temp_image = IJ.openImage(file.getAbsolutePath()) | ||
+ | |||
+ | def images = ChannelSplitter.split(temp_image) | ||
+ | |||
+ | // 0 is ch1 view 1 | ||
+ | // 1 is ch1 view 2 | ||
+ | // 2 is ch2 view 1 | ||
+ | // 3 is ch2 view 2 | ||
+ | | ||
+ | //resave all | ||
+ | def image_name = file.name.take(file.name.lastIndexOf(' | ||
+ | IJ.saveAsTiff(images[0], | ||
+ | IJ.saveAsTiff(images[1], | ||
+ | IJ.saveAsTiff(images[2], | ||
+ | IJ.saveAsTiff(images[3], | ||
+ | images.each{it.close()} | ||
+ | | ||
+ | temp_image.close() | ||
+ | |||
+ | println(" | ||
+ | } | ||
+ | //} | ||
+ | |||
+ | </ |