public int setup(String arg, ImagePlus imp) { this.imp = imp; (new ChannelSplitter()).run(arg); return DONE; }
/** Deprecated; replaced by ChannelSplitter.splitRGB(). */ public void split(ImageStack rgb, boolean keepSource) { ImageStack[] channels = ChannelSplitter.splitRGB(rgb, keepSource); red = channels[0]; green = channels[1]; blue = channels[2]; }
@Override public void parse() { super.parse(); nSamples = radii.size(); stack = (imp.isComposite()) ? ChannelSplitter.getChannel(imp, channel) : imp.getStack(); vxW = cal.pixelWidth; vxH = cal.pixelHeight; vxD = cal.pixelDepth; // Split processing across the number of available CPUs final Thread[] threads = new Thread[nCPUs]; setThreadedCounter(0); for (int ithread = 0; ithread < threads.length; ithread++) { final int chunkSize = (nSamples + nCPUs - 1) / nCPUs; // divide by // threads // rounded // up. final int start = ithread * chunkSize; final int end = Math.min(start + chunkSize, nSamples); threads[ithread] = threadService.newThread(new ChunkParser(start, end)); } ThreadUtil.startAndJoin(threads); }
public void run(String arg) { ImagePlus imp = IJ.getImage(); if (imp.isComposite()) { int z = imp.getSlice(); int t = imp.getFrame(); ImagePlus[] channels = split(imp); imp.changes = false; imp.setIgnoreFlush(true); imp.close(); for (int i=0; i<channels.length; i++) { channels[i].setIJMenuBar(i==channels.length-1); channels[i].show(); if (z>1 || t>1) channels[i].setPosition(1, z, t); } } else if (imp.getType()==ImagePlus.COLOR_RGB) splitRGB(imp); else IJ.error("Split Channels", "Multichannel image required"); }
/** Creates a hyperstack montage and returns it as an ImagePlus. */ private ImagePlus makeHyperstackMontage(ImagePlus imp, int columns, int rows, double scale, int inc, int borderWidth, boolean labels) { ImagePlus[] channels = ChannelSplitter.split(imp); int n = channels.length; ImagePlus[] montages = new ImagePlus[n]; for (int i=0; i<n; i++) { int last = channels[i].getStackSize(); montages[i] = makeMontage2(channels[i], columns, rows, scale, 1, last, inc, borderWidth, labels); } ImagePlus montage = (new RGBStackMerge()).mergeHyperstacks(montages, false); montage.setCalibration(montages[0].getCalibration()); montage.setTitle("Montage"); return montage; }
if (entireStack) { if (imp.isHyperStack()) { ImageStack stack = ChannelSplitter.getChannel(imp, imp.getChannel()); stats = new StackStatistics(new ImagePlus("", stack)); } else
public void run(String arg) { ImagePlus imp = IJ.getImage(); if (imp.isComposite()) { int z = imp.getSlice(); int t = imp.getFrame(); ImagePlus[] channels = split(imp); imp.changes = false; imp.setIgnoreFlush(true); imp.close(); for (int i=0; i<channels.length; i++) { channels[i].setIJMenuBar(i==channels.length-1); channels[i].show(); if (z>1 || t>1) channels[i].setPosition(1, z, t); } } else if (imp.getType()==ImagePlus.COLOR_RGB) splitRGB(imp); else IJ.error("Split Channels", "Multichannel image required"); }
/** Creates a hyperstack montage and returns it as an ImagePlus. */ private ImagePlus makeHyperstackMontage(ImagePlus imp, int columns, int rows, double scale, int inc, int borderWidth, boolean labels) { ImagePlus[] channels = ChannelSplitter.split(imp); int n = channels.length; ImagePlus[] montages = new ImagePlus[n]; for (int i=0; i<n; i++) { int last = channels[i].getStackSize(); montages[i] = makeMontage2(channels[i], columns, rows, scale, 1, last, inc, borderWidth, labels); } ImagePlus montage = (new RGBStackMerge()).mergeHyperstacks(montages, false); montage.setCalibration(montages[0].getCalibration()); montage.setTitle("Montage"); return montage; }
public int setup(String arg, ImagePlus imp) { this.imp = imp; (new ChannelSplitter()).run(arg); return DONE; }
/** Deprecated; replaced by ChannelSplitter.splitRGB(). */ public void split(ImageStack rgb, boolean keepSource) { ImageStack[] channels = ChannelSplitter.splitRGB(rgb, keepSource); red = channels[0]; green = channels[1]; blue = channels[2]; }
if (entireStack) { if (imp.isHyperStack()) { ImageStack stack = ChannelSplitter.getChannel(imp, imp.getChannel()); stats = new StackStatistics(new ImagePlus("", stack)); } else
private static void filterHyperstack(ImagePlus imp, int filter, float vx, float vy, float vz) { if (imp.getNDimensions()>4) { IJ.error("5D hyperstacks are currently not supported"); return; } if (imp.getNChannels()==1) { ImageStack stack = filter(imp.getStack(), filter, vx, vy, vz); imp.setStack(stack); return; } ImagePlus[] channels = ChannelSplitter.split(imp); int n = channels.length; for (int i=0; i<n; i++) { ImageStack stack = filter(channels[i].getStack(), filter, vx, vy, vz); channels[i].setStack(stack); } ImagePlus imp2 = RGBStackMerge.mergeChannels(channels, false); imp.setImage(imp2); imp.setC(1); }
/** Deprecated; replaced by ij.plugin.ChannelSplitter. */ public void split(ImagePlus imp) { WindowManager.setTempCurrentImage(imp); (new ChannelSplitter()).run(""); }
private static ImageStack filterRGB(ImageStack rgb_in, int filter, float vx, float vy, float vz) { ImageStack[] channels = ChannelSplitter.splitRGB(rgb_in, false); ImageStack red = filter(channels[0], filter, vx, vy, vz); ImageStack green = filter(channels[1], filter, vx, vy, vz); ImageStack blue = filter(channels[2], filter, vx, vy, vz); return RGBStackMerge.mergeStacks(red, green, blue, false); }
private static void filterHyperstack(ImagePlus imp, int filter, float vx, float vy, float vz) { if (imp.getNDimensions()>4) { IJ.error("5D hyperstacks are currently not supported"); return; } if (imp.getNChannels()==1) { ImageStack stack = filter(imp.getStack(), filter, vx, vy, vz); imp.setStack(stack); return; } ImagePlus[] channels = ChannelSplitter.split(imp); int n = channels.length; for (int i=0; i<n; i++) { ImageStack stack = filter(channels[i].getStack(), filter, vx, vy, vz); channels[i].setStack(stack); } ImagePlus imp2 = RGBStackMerge.mergeChannels(channels, false); imp.setImage(imp2); imp.setC(1); }
/** Deprecated; replaced by ij.plugin.ChannelSplitter. */ public void split(ImagePlus imp) { WindowManager.setTempCurrentImage(imp); (new ChannelSplitter()).run(""); }
private static ImageStack filterRGB(ImageStack rgb_in, int filter, float vx, float vy, float vz) { ImageStack[] channels = ChannelSplitter.splitRGB(rgb_in, false); ImageStack red = filter(channels[0], filter, vx, vy, vz); ImageStack green = filter(channels[1], filter, vx, vy, vz); ImageStack blue = filter(channels[2], filter, vx, vy, vz); return RGBStackMerge.mergeStacks(red, green, blue, false); }
int slice = img.getSlice(); int frame = img.getFrame(); ImagePlus[] channels = ChannelSplitter.split(img); int nChannels2 = newOrder.length; if (nChannels2>channels.length)
/** Returns, as an ImageStack, the specified channel, where 'c' must be greater than zero and less than or equal to the number of channels in the image. */ public static ImageStack getChannel(ImagePlus imp, int c) { if (imp.getBitDepth()==24) { // RGB? if (c<1 || c>3) throw new IllegalArgumentException("Channel must be 1,2 or 3"); ImageStack[] channels = splitRGB(imp.getStack(), true); return channels[c-1]; } if (c<1 || c>imp.getNChannels()) throw new IllegalArgumentException("Channel less than 1 or greater than "+imp.getNChannels()); ImageStack stack1 = imp.getStack(); ImageStack stack2 = new ImageStack(imp.getWidth(), imp.getHeight()); for (int t=1; t<=imp.getNFrames(); t++) { for (int z=1; z<=imp.getNSlices(); z++) { int n = imp.getStackIndex(c, z, t); stack2.addSlice(stack1.getProcessor(n)); } } return stack2; }
int slice = img.getSlice(); int frame = img.getFrame(); ImagePlus[] channels = ChannelSplitter.split(img); int nChannels2 = newOrder.length; if (nChannels2>channels.length)