Short Description
This script allow you to export all pixels values which are contained in the ROI(s) into a excel file.Versions
-
Version 2 • Released on: 2017-11-21 15:53:52DownloadDescription:
Fixed a small bug
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(), ".xls") //create a new excel document wb = XLSUtil.createWorkbook(path) sh = XLSUtil.createNewPage(wb, "Pixels intensitiezs") // create an iterator through the given sequence and ROI it = new SequenceDataIterator(s, r) // set column titles XLSUtil.setCellString(sh, 0, 0, "X") XLSUtil.setCellString(sh, 1, 0, "Y") XLSUtil.setCellString(sh, 2, 0, "C") XLSUtil.setCellString(sh, 3, 0, "Z") XLSUtil.setCellString(sh, 4, 0, "T") XLSUtil.setCellString(sh, 5, 0, "Value") line = 1 while(!it.done()) { // set position information XLSUtil.setCellNumber(sh, 0, line, it.getPositionX()) XLSUtil.setCellNumber(sh, 1, line, it.getPositionY()) XLSUtil.setCellNumber(sh, 2, line, it.getPositionC()) XLSUtil.setCellNumber(sh, 3, line, it.getPositionZ()) XLSUtil.setCellNumber(sh, 4, line, it.getPositionT()) // set value XLSUtil.setCellNumber(sh, 5, line, it.get()) // pass to next value it.next() line++ } // save and close excel document XLSUtil.saveAndClose(wb) // done p.close() } }
-
Version 1 • Released on: 2014-06-03 10:44:25DownloadDescription:
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 path = FileDialog.open() if (path != null) { // display progress frame p = new ProgressFrame("exporting...") // set XLS extension path = FileUtil.setExtension(path, ".xls") //create a new excel document wb = XLSUtil.createWorkbook(path) sh = XLSUtil.createNewPage(wb, "Pixels intensitiezs") // create an iterator through the given sequence and ROI it = new SequenceDataIterator(s, r) // set column titles XLSUtil.setCellString(sh, 0, 0, "X") XLSUtil.setCellString(sh, 1, 0, "Y") XLSUtil.setCellString(sh, 2, 0, "C") XLSUtil.setCellString(sh, 3, 0, "Z") XLSUtil.setCellString(sh, 4, 0, "T") XLSUtil.setCellString(sh, 5, 0, "Value") line = 1 while(!it.done()) { // set position information XLSUtil.setCellNumber(sh, 0, line, it.getPositionX()) XLSUtil.setCellNumber(sh, 1, line, it.getPositionY()) XLSUtil.setCellNumber(sh, 2, line, it.getPositionC()) XLSUtil.setCellNumber(sh, 3, line, it.getPositionZ()) XLSUtil.setCellNumber(sh, 4, line, it.getPositionT()) // set value XLSUtil.setCellNumber(sh, 5, line, it.get()) // pass to next value it.next() line++ } // save and close excel document XLSUtil.saveAndClose(wb) // done p.close() } }