use of ij.plugin.Duplicator in project mcib3d-core by mcib3d.
the class ImagePlus_Utils method extractCurrentStack.
public static ImagePlus extractCurrentStack(ImagePlus plus) {
// check dimensions
// XYCZT
int[] dims = plus.getDimensions();
int channel = plus.getChannel();
int frame = plus.getFrame();
ImagePlus stack;
// crop actual frame
if ((dims[2] > 1) || (dims[4] > 1)) {
IJ.log("Hyperstack found, extracting current channel " + channel + " and frame " + frame);
Duplicator duplicator = new Duplicator();
stack = duplicator.run(plus, channel, channel, 1, dims[3], frame, frame);
} else
stack = plus.duplicate();
return stack;
}
use of ij.plugin.Duplicator in project volumetric-tissue-exploration-analysis by icbm-iupui.
the class JTextAreaFile method getMaskStack.
private ImagePlus getMaskStack(MicroObject vol, int[] starts) {
int xStart = starts[0];
int yStart = starts[1];
int zStart = starts[2];
// ImageStack cropMe = image.getImageStack();
ChannelSplitter cs = new ChannelSplitter();
// Roi r = new Roi(xStart, yStart, size, size);
image.setRoi(new Rectangle(xStart, yStart, size, size));
Duplicator dup = new Duplicator();
ImagePlus objImp = dup.run(image);
// 32x32x19
ImageStack stNu = cs.getChannel(objImp, channelOfInterest);
int[] xPixels = vol.getPixelsX();
int[] yPixels = vol.getPixelsY();
int[] zPixels = vol.getPixelsZ();
ImagePlus temp = IJ.createImage("nuclei", size, size, depth, objImp.getBitDepth());
// temp.show();
ImageStack tempStack = temp.getImageStack();
try {
for (int i = 0; i < xPixels.length; i++) {
tempStack.setVoxel(xPixels[i] - xStart, yPixels[i] - yStart, zPixels[i] - zStart, stNu.getVoxel(xPixels[i] - xStart, yPixels[i] - yStart, zPixels[i]));
}
} catch (Exception ex) {
System.out.println("PROFILING: mask stack, object, " + vol.getSerialID() + " dumped with start at: " + zStart);
return null;
}
// }
return temp;
}
use of ij.plugin.Duplicator in project volumetric-tissue-exploration-analysis by icbm-iupui.
the class JTextAreaFile method getBoxStack_old.
private ImagePlus getBoxStack_old(MicroObject vol, int[] starts) {
int xStart = starts[0];
int yStart = starts[1];
int zStart = starts[2];
int finish = depth + zStart;
// System.out.println("zstart " + zStart);
// System.out.println("finish " + finish);
Duplicator dup = new Duplicator();
image.setRoi(new Rectangle(xStart, yStart, size, size));
ImagePlus objImp = dup.run(image);
ChannelSplitter cs = new ChannelSplitter();
ImageStack stNu = cs.getChannel(objImp, channelOfInterest);
ImagePlus objImpNu = new ImagePlus("nuclei", stNu);
try {
objImpNu = dup.run(objImpNu, zStart + 1, finish);
} catch (IllegalArgumentException ex) {
System.out.println("PROFILING: box stack, object, " + vol.getSerialID() + " dumped with start at: " + zStart);
return null;
}
return objImpNu;
}
use of ij.plugin.Duplicator in project volumetric-tissue-exploration-analysis by icbm-iupui.
the class JTextAreaFile method get2ChannelStack.
private ImagePlus get2ChannelStack(MicroObject vol, int[] starts) {
int xStart = starts[0];
int yStart = starts[1];
int zStart = starts[2];
int finish = depth + zStart;
// System.out.println("zstart " + zStart);
// System.out.println("finish " + finish);
ImageStack cropMe = image.getImageStack();
ChannelSplitter cs = new ChannelSplitter();
RGBStackMerge sm = new RGBStackMerge();
// Roi r = new Roi(xStart, yStart, size, size);
image.setRoi(new Rectangle(xStart, yStart, size, size));
Duplicator dup = new Duplicator();
ImagePlus objImp = dup.run(image);
// ImageStack stNu = cs.getChannel(objImp, 8); //TODO: nuclei channel is hardcoded
// ImageStack stActin = cs.getChannel(objImp, 1);
// ImageStack stapq1 = cs.getChannel(objImp, 3);
ImagePlus[] sts = cs.split(objImp);
ImagePlus[] sts_select = new ImagePlus[3];
sts_select[0] = sts[0];
sts_select[1] = sts[2];
sts_select[2] = sts[7];
// ImageStack multichannel = sm.mergeStacks(size, size, objImp.getNSlices(), stNu, stActin, stapq1, false);
ImagePlus objImpNu = new ImagePlus();
HyperStackConverter hsc = new HyperStackConverter();
// objImpNu = objImpNu.createHyperStack("multi", sts_select.length, objImp.getNSlices(), objImp.getNFrames(), objImp.getBitDepth());
objImpNu = IJ.createHyperStack("multi", size, size, sts_select.length, objImp.getNSlices(), objImp.getNFrames(), objImp.getBitDepth());
// for (int c = 1; c <= sts_select.length; c++){
// objImpNu.setC(c);
// objImpNu.setStack(sts_select[c-1].getStack());
// }
// ImagePlus objImpNu = new ImagePlus("nuclei", multichannel);
// TODO validate this is correct
ImagePlus objImpNu_crop = dup.run(objImpNu, zStart, zStart + depth - 1);
return objImpNu_crop;
}
use of ij.plugin.Duplicator in project volumetric-tissue-exploration-analysis by icbm-iupui.
the class JTextAreaFile method getBoxStack.
private ImagePlus getBoxStack(MicroObject vol, int[] starts) {
int xStart = starts[0];
int yStart = starts[1];
int zStart = starts[2];
// ImageStack cropMe = image.getImageStack();
ChannelSplitter cs = new ChannelSplitter();
// Roi r = new Roi(xStart, yStart, size, size);
image.setRoi(new Rectangle(xStart, yStart, size, size));
Duplicator dup = new Duplicator();
ImagePlus objImp = dup.run(image);
ImageStack stNu = cs.getChannel(objImp, channelOfInterest);
ImagePlus temp = IJ.createImage("nuclei", size, size, depth, objImp.getBitDepth());
ImageStack tempStack = temp.getImageStack();
try {
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
for (int k = 0; k < depth; k++) {
tempStack.setVoxel(i, j, k, stNu.getVoxel(i, j, k + zStart));
}
}
}
} catch (Exception ex) {
System.out.println("PROFILING: box2 stack, object, " + vol.getSerialID() + " dumped with start at: " + zStart);
return null;
}
return temp;
}
Aggregations