/** * Get stack width * @return stack width */ public int getWidth(){ return wholeStack.getWidth(); }
/** * Get stack width * @return stack width */ public int getWidth(){ return wholeStack.getWidth(); }
public static final double samplingVolume(ImageStack image, Calibration calib) { // size of image int sizeX = image.getWidth(); int sizeY = image.getHeight(); int sizeZ = image.getSize(); return (sizeX - 1) * calib.pixelWidth * (sizeY - 1) * calib.pixelHeight * (sizeZ - 1) * calib.pixelDepth; }
public VolumeInteger(ImageStack s, int depth, int n, double aspectx, double aspecty, double aspectz) /* Creates a volume from an ImageStack, with depth slices from n * depth. This is used to extract n-th volume from an ImageStack representing a hypervolume (multiple volumes in one stack). */ { this(s.getWidth(), s.getHeight(), depth, aspectx, aspecty, aspectz); load(s, n * depth); } public int [][][] getVolume() { return v; }
public VolumeShort(ImageStack s, int depth, int n, double aspectx, double aspecty, double aspectz) /* Creates a volume from an ImageStack, with depth slices from n * depth. This is used to extract n-th volume from an ImageStack representing a hypervolume (multiple volumes in one stack). */ { this(s.getWidth(), s.getHeight(), depth, aspectx, aspecty, aspectz); load(s, n * depth); } /**
final private void updateScrollBar() { final double[] min = new double[]{ 0, 0, 0 }; final double[] max = new double[]{ stack.getWidth() - 1, stack.getHeight() - 1, stack.getSize() - 1 }; reducedAffine.estimateBounds( min, max ); min[ 2 ] += currentSlice; max[ 2 ] += currentSlice; gui.scrollBar.setValues( ( int )Math.round( currentSlice ), 1, ( int )Math.round( min[ 2 ] ), ( int )Math.round( max[ 2 ] ) ); }
/** * Creates a float volume from an ImageJ ImageStack. * @param s the ImageStack to be used. */ public VolumeFloat(ImageStack s) { this(s.getWidth(), s.getHeight(), s.getSize(), 1.0, 1.0, 1.0); load(s, 0); } /**
public VolumeInteger(ImageStack s, double aspectx, double aspecty, double aspectz) // Creates a volume from an ImageStack. { this(s.getWidth(), s.getHeight(), s.getSize(), aspectx, aspecty, aspectz); load(s, 0); } public VolumeInteger(ImageStack s)
/** * Create a new hypervolume from a stack of volumes. No convolution. * Each volume has a depth of depth (slices). * @param is and ImageJ ImageStack containing the slices. * @param depth the depth of each volume in the hypervolume. */ public HyperVolume(ImageStack is, int depth) { this(is.getWidth(), is.getHeight(), depth, is.getSize() / depth); load(is, 0); } /**
public static ImageStack mergeStacks(ImageStack red, ImageStack green, ImageStack blue, boolean keepSource) { RGBStackMerge merge = new RGBStackMerge(); return merge.mergeStacks(red.getWidth(), red.getHeight(), red.getSize(), red, green, blue, keepSource); }
public ImageStack makeSubStack(ImageStack stack, int beginSlice, int endSlice) { ImageStack newStack = new ImageStack(stack.getWidth(), stack.getHeight(), stack.getColorModel()); for(int i = beginSlice; i < endSlice; ++i) { newStack.addSlice(stack.getProcessor(i+1)); } return newStack; }
public MaxEntHistogram(ImagePlus image) { values=new long[256]; ImageStack stack=image.getStack(); for(int i=1;i<=stack.getSize();i++) initHistogram((ByteProcessor)stack.getProcessor(i)); total=stack.getWidth()*stack.getHeight()*stack.getSize(); }
public ImageStack makeShuffled(ImageStack stack) { ImageStack newStack = new ImageStack(stack.getWidth(), stack.getHeight(), stack.getColorModel()); for(int channel = 0; channel < nChannels; ++channel) { for(int i = channel; i < stack.getSize(); i += nChannels) { newStack.addSlice(stack.getProcessor(i+1)); } } return newStack; } }
ImageStack unpad(ImageStack stack) { Object w = imp.getProperty("FFT width"); Object h = imp.getProperty("FFT height"); if (w==null || h==null) return stack; int width = (int)Tools.parseDouble((String)w, 0.0); int height = (int)Tools.parseDouble((String)h, 0.0); if (width==0 || height==0 || (width==stack.getWidth()&&height==stack.getHeight())) return stack; StackProcessor sp = new StackProcessor(stack, null); ImageStack stack2 = sp.crop(0, 0, width, height); return stack2; }
private void doHSRGBProjection(ImagePlus rgbImp) { ImageStack stack = rgbImp.getStack(); ImageStack stack2 = new ImageStack(stack.getWidth(), stack.getHeight()); for (int i=startSlice; i<=stopSlice; i++) stack2.addSlice(null, stack.getProcessor(i)); startSlice = 1; stopSlice = stack2.getSize(); doRGBProjection(stack2); }
ImageStack unpad(ImageStack stack) { Object w = imp.getProperty("FFT width"); Object h = imp.getProperty("FFT height"); if (w==null || h==null) return stack; int width = (int)Tools.parseDouble((String)w, 0.0); int height = (int)Tools.parseDouble((String)h, 0.0); if (width==0 || height==0 || (width==stack.getWidth()&&height==stack.getHeight())) return stack; StackProcessor sp = new StackProcessor(stack, null); ImageStack stack2 = sp.crop(0, 0, width, height); return stack2; }
public VolumeShort(ImageStack s, double aspectx, double aspecty, double aspectz) throws Exception // Creates a volume from an ImageStack. { this(s.getWidth(), s.getHeight(), s.getSize(), aspectx, aspecty, aspectz); if (! load(s, 0)) throw new Exception("Cannot instantiate volume from ImageStack"); } /**
private final void invertGray8Stack(ImageStack image) { int sizeX = image.getWidth(); int sizeY = image.getHeight(); int sizeZ = image.getSize(); for (int z = 0; z < sizeZ; z++) { for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { image.setVoxel(x, y, z, 255 - image.getVoxel(x, y, z)); } } } }
private void doRotation() { ImageStack stack = imp.getStack(); flow = new FlowJFlow(stack.getWidth(), stack.getHeight()); xError = getIntField(xField); yError = getIntField(yField); flow.createRotation(xError, yError, -5 * (float) Math.PI / 180, getRoi()); ((FlowJCanvas) win.getCanvas()).setDisplayed(flow); description = "rotation field"; fastDisplay(); } private void doCentralImage()
private ImageStack invertGray8Image(ImageStack image) { ImageStack result = image.duplicate(); for(int z = 0; z < image.getSize(); z++) { for(int y = 0; y < image.getHeight(); y++) { for(int x = 0; x < image.getWidth(); x++) { result.setVoxel(x, y, z, 255 - image.getVoxel(x, y, z)); } } } return result; }