Short Description
This small script export all contained pixel (position and value) into a CSV file. Warning: this script may require a lot of memory to run !Versions
-
Version 2 • Released on: 2018-06-26 10:04:03Download
importClass(Packages.icy.gui.frame.progress.ProgressFrame) importClass(Packages.icy.file.FileUtil) importClass(Packages.plugins.tprovoost.scripteditor.uitools.filedialogs.FileDialog) importClass(Packages.icy.util.XLSUtil) importClass(Packages.icy.util.XMLUtil) importClass(Packages.icy.util.ShapeUtil) importClass(Packages.icy.roi.ROIUtil) importClass(Packages.icy.sequence.SequenceDataIterator) importClass(Packages.java.io.PrintWriter) // get active sequence s = getSequence() // merge all ROI from image in a single one (OR operation) r = ROIUtil.merge(s.getROIs(), ShapeUtil.BooleanOperator.OR) if (r != null) { // request path to save XLS result file = FileDialog.open() if (file != null) { // display progress frame p = new ProgressFrame("exporting...") // set XLS extension path = FileUtil.setExtension(file.getAbsolutePath(), ".csv") // create empty sheet sheet = "" // create an iterator through the given sequence and ROI it = new SequenceDataIterator(s, r) // set column titles sheet += "XtYtCtZtTtValuen" while(!it.done()) { // set position information sheet += it.getPositionX() + "t" +it.getPositionY() + "t" +it.getPositionC() + "t" +it.getPositionZ() + "t" +it.getPositionT() + "t" // set value sheet += it.get() + "n" // pass to next value it.next() } try { // save file FileUtil.save(path, sheet.getBytes(), true) } catch(e) { // error ? use another method out = new PrintWriter(path) out.println(sheet) out.close() } // done p.close() } }
-
Version 1 • Released on: 2017-11-21 15:56:03DownloadDescription:
initial version
importClass(Packages.icy.gui.frame.progress.ProgressFrame) importClass(Packages.icy.file.FileUtil) importClass(Packages.plugins.tprovoost.scripteditor.uitools.filedialogs.FileDialog) importClass(Packages.icy.util.XLSUtil) importClass(Packages.icy.util.XMLUtil) importClass(Packages.icy.util.ShapeUtil) importClass(Packages.icy.roi.ROIUtil) importClass(Packages.icy.sequence.SequenceDataIterator) // get active sequence s = getSequence() // merge all ROI from image in a single one (OR operation) r = ROIUtil.merge(s.getROIs(), ShapeUtil.BooleanOperator.OR) if (r != null) { // request path to save XLS result file = FileDialog.open() if (file != null) { // display progress frame p = new ProgressFrame("exporting...") // set XLS extension path = FileUtil.setExtension(file.getAbsolutePath(), ".csv") // create empty sheet sheet = "" // create an iterator through the given sequence and ROI it = new SequenceDataIterator(s, r) // set column titles sheet += "XtYtCtZtTtValuen" while(!it.done()) { // set position information sheet += it.getPositionX() + "t" +it.getPositionY() + "t" +it.getPositionC() + "t" +it.getPositionZ() + "t" +it.getPositionT() + "t" // set value sheet += it.get() + "n" // pass to next value it.next() } // save file FileUtil.save(path, sheet.getBytes(), true) // done p.close() } }