def _get_args_as_java_array(*args): """ Convert the Python args list into a Java array of strings. :param args: the args list :return: the Java array of strings """ result = JArrayList() if args is not None and len(args) > 0: for arg in args: result.add(str(arg)) return result.toArray()
def _get_args_as_java_array(*args): """ Convert the Python args list into a Java array of strings. :param args: the args list :return: the Java array of strings """ result = JArrayList() if args is not None and len(args) > 0: for arg in args: if arg is not None: if isinstance(arg, unicode) or isinstance(arg, str): result.add(arg) elif isinstance(arg, JObject): result.add(arg.toString()) else: result.add(unicode(arg)) else: result.add(str(arg)) return result.toArray()
# 1 corresponds to the second mass image (e.g. mass 13.0) ratioProps1 = RatioProps(1, 0) mp1 = MimsPlus(ui, ratioProps1) imageArray.add(mp1) IJ.log("Opening ratio: " + mp1.getTitle()) # Ratio images # 2 corresponds to the first mass image (e.g. mass 26.0) # 3 corresponds to the second mass image (e.g. mass 27.0) ratioProps2 = RatioProps(3, 2) mp2 = MimsPlus(ui, ratioProps2) imageArray.add(mp2) IJ.log("Opening ratio: " + mp2.getTitle()) images = jarray.zeros(imageArray.size(), MimsPlus) images = imageArray.toArray(images) #//////////////////////////// # Create and display table. #//////////////////////////// table = MimsJTable(ui) table.setStats(stats) table.setRois(rois) table.setImages(images) table.setPlanes(planes) #append=false nPlanes = ui.getOpener().getNImages() if nPlanes > 1: table.createTable(False) else: table.createSumTable(False)
# 1 corresponds to the second mass image (e.g. mass 13.0) ratioProps1 = RatioProps(1, 0) mp1 = MimsPlus(ui, ratioProps1) imageArray.add(mp1) IJ.log("Opening ratio: "+mp1.getTitle()) # Ratio images # 2 corresponds to the first mass image (e.g. mass 26.0) # 3 corresponds to the second mass image (e.g. mass 27.0) ratioProps2 = RatioProps(3, 2) mp2 = MimsPlus(ui, ratioProps2) imageArray.add(mp2) IJ.log("Opening ratio: "+mp2.getTitle()) images = jarray.zeros(imageArray.size(), MimsPlus) images = imageArray.toArray(images) #//////////////////////////// # Create and display table. #//////////////////////////// table = MimsJTable(ui) table.setStats(stats) table.setRois(rois) table.setImages(images) table.setPlanes(planes) #append=false nPlanes = ui.getOpener().getNImages() if nPlanes > 1: table.createTable(False) else: table.createSumTable(False)
mimStack = ui.getmimsStackEditing() imp = ArrayList() images = ui.getOpenMassImages() #compress the planes blockSize = images[0].getNSlices() done = mimStack.compressPlanes(blockSize) #force to 32bit massCorrection = nrimsData.massCorrection(ui) massCorrection.forceFloatImages(images) if done: nw = nrimsData.Nrrd_Writer(ui) dataFile = nw.save(images, System.getProperty("java.io.tmpdir"), "comp_" + name) tempFiles.add(dataFile) tempFileArray = tempFiles.toArray() #all work is done in first file ui.openFile(tempFileArray[0]) for i in range(len(tempFileArray)): if i != 0: IJ.log("Concating file " + str(i)); directory = tempFileArray[i].getParent() name = tempFileArray[i].getName() tempUi = nrims.UI() tempUi.openFile(tempFileArray[i]) tempImage = tempUi.getOpener() image = ui.getOpener() images = ui.getOpenMassImages() mimStack = ui.getmimsStackEditing() for j in range(len(images)): images[j].setTitle(name)