def make_montage(self, xy="", montage_name=""): if self.channels_to_montage == None: channels_to_montage = self.channel_names else: channels_to_montage = self.channels_to_montage w = self.cropped_imps[self.channel_names[0]].width h = self.cropped_imps[self.channel_names[0]].height new_stack = ImageStack(w, h) # print self.cropped_imps.keys() for channel in channels_to_montage: img = self.cropped_imps[channel].getProcessor() new_stack.addSlice(img) tomontage = ImagePlus("to montage", new_stack) montager = MontageMaker() self.montage = montager.makeMontage2( tomontage, len(channels_to_montage), 1, 1, 1, len(channels_to_montage), 1, 0, 0 ) directory = self.outdir file_name = self.name save_as = os.path.join(directory, "%s_%s_montage.tif" % (file_name, xy)) IJ.save(self.montage, save_as)
# testMontageMaker from ij import IJ, WindowManager, ImageStack, ImagePlus from ij.io import FileInfo from ij.plugin import MontageMaker import jmFijiGen as jmg IJ.run("Lena (68K)") lena = IJ.getImage() lI = [lena, lena, lena] stack = jmg.makeStackFromListRGB(lI) mont = MontageMaker() # starts with a stack (stack) and returns an imp to the montage # makeMontage2(ImagePlus imp, int columns, int rows, double scale, int first, int last, int inc, int borderWidth, boolean labels) imp = mont.makeMontage2(stack, 3, 1, 1.0, 1, 3, 1, 0, False) imp.show()
def __fmosa(self) : mm = MontageMaker() imp = mm.makeMontage2(self.__impRes, 1, self.__impRes.getStackSize(), 1, 1, self.__impRes.getStackSize(), 1, 0, False) imp.setTitle("MONTAGE"+self.__name) imp.show() if self.__fire : IJ.run(imp, "Fire", "")
# # print 'fitGoodness', cv.getFitGoodness() # # print 'formula', cv.getFormula() # # fit_params = cv.getParams() # # print 'fit_params', fit_params # print all_pc # print 'mean_cc', sum(all_pc)/len(all_pc) # Create the 2D visualization of the fit plots stack_w, stack_h = plot_images[0].getWidth(), plot_images[0].getHeight() stack_plot = ImageStack(stack_w, stack_h) # add all the plots in a stack for id, plot_image in enumerate(plot_images): for i in range(HEXAGON_SPACINGS[id]): stack_plot.addSlice( 'plot_' + str(id).zfill(2), ImagePlus('empty', ColorProcessor(stack_w, stack_h)).getProcessor()) stack_plot.addSlice('plot_' + str(id).zfill(2), plot_image.getProcessor()) imp = ImagePlus('Plot_stack', stack_plot) montageMaker = MontageMaker() montage = montageMaker.makeMontage2(imp, 17, 9, 1, 1, imp.getNSlices(), 1, 3, False) IJ.save(montage, fit_montage_path) montage.show() IJ.log('Done')