Refine search
/** * Gets the number of slices or frames available in the image, * depending on whit is tracked. */ protected int getMaxPosition(ImagePlus img) { if (trackZ) return img.getNSlices(); else return img.getNFrames(); }
protected void setPosition(final int channel, final int frame) { if (channel < 1 || channel > imp.getNChannels() || frame < 1 || frame > imp.getNFrames()) throw new IllegalArgumentException("Specified (channel, slice, frame) position is out of range"); this.channel = channel; // 1-based this.frame = frame; // 1-based properties.setProperty(KEY_CHANNEL_POS, String.valueOf(channel)); properties.setProperty(KEY_FRAME_POS, String.valueOf(frame)); }
public boolean validDimensions() { int c = imp.getNChannels(); int z = imp.getNSlices(); int t = imp.getNFrames(); //IJ.log(c+" "+z+" "+t+" "+nChannels+" "+nSlices+" "+nFrames+" "+imp.getStackSize()); int size = imp.getStackSize(); if (c==size && c*z*t==size && nSlices==size && nChannels*nSlices*nFrames==size) return true; if (c!=nChannels||z!=nSlices||t!=nFrames||c*z*t!=size) return false; else return true; }
public boolean validDimensions() { int c = imp.getNChannels(); int z = imp.getNSlices(); int t = imp.getNFrames(); //IJ.log(c+" "+z+" "+t+" "+nChannels+" "+nSlices+" "+nFrames+" "+imp.getStackSize()); int size = imp.getStackSize(); if (c==size && c*z*t==size && nSlices==size && nChannels*nSlices*nFrames==size) return true; if (c!=nChannels||z!=nSlices||t!=nFrames||c*z*t!=size) return false; else return true; }
public static String testRegistrationCompatibility( final ImagePlus imp1, final ImagePlus imp2 ) { // test time points final int numFrames1 = imp1.getNFrames(); final int numFrames2 = imp2.getNFrames(); if ( numFrames1 != numFrames2 ) return "Images have a different number of time points, cannot proceed..."; // test if both have 2d or 3d image contents final int numSlices1 = imp1.getNSlices(); final int numSlices2 = imp2.getNSlices(); if ( numSlices1 == 1 && numSlices2 != 1 || numSlices1 != 1 && numSlices2 == 1 ) return "One image is 2d and the other one is 3d, cannot proceed..."; return null; } }
private String centerDescription() { final StringBuilder sb = new StringBuilder(); sb.append("X=").append(ShollUtils.d2s(center.x)); sb.append(" Y=").append(ShollUtils.d2s(center.y)); if (!twoD) sb.append(" Z=").append(ShollUtils.d2s(center.z)); if (imp.getNChannels() > 1) sb.append(" C=").append(posC); if (imp.getNFrames() > 1) sb.append(" T=").append(posT); return sb.toString(); }
private HyperStackIterator(final ImagePlus image) { this.image = image; nChannels = image.getNChannels(); nSlices = image.getNSlices(); nFrames = image.getNFrames(); System.out.println("nFrames = " + nFrames); w = image.getWidth(); h = image.getHeight(); }
public static String testRegistrationCompatibility( final ImagePlus imp1, final ImagePlus imp2 ) { // test time points final int numFrames1 = imp1.getNFrames(); final int numFrames2 = imp2.getNFrames(); if ( numFrames1 != numFrames2 ) return "Images have a different number of time points, cannot proceed..."; // test if both have 2d or 3d image contents final int numSlices1 = imp1.getNSlices(); final int numSlices2 = imp2.getNSlices(); if ( numSlices1 == 1 && numSlices2 != 1 || numSlices1 != 1 && numSlices2 == 1 ) return "One image is 2d and the other one is 3d, cannot proceed..."; return null; }
protected SetupImgLoader( final BasicSetupImgLoader< S > loader ) { this.loader = loader; }
private void setDefaultBounds() { int stackSize = imp.getStackSize(); int channels = imp.getNChannels(); int frames = imp.getNFrames(); int slices = imp.getNSlices(); isHyperstack = imp.isHyperStack()||( ij.macro.Interpreter.isBatchMode()&&((frames>1&&frames<stackSize)||(slices>1&&slices<stackSize))); simpleComposite = channels==stackSize; if (simpleComposite) isHyperstack = false; startSlice = 1; if (isHyperstack) { int nSlices = imp.getNSlices(); if (nSlices>1) stopSlice = nSlices; else stopSlice = imp.getNFrames(); } else stopSlice = stackSize; }
int updateIndex(int n) { if (imp.getNFrames()>1) return (int)(n*((double)(imp.getNFrames())/imp.getStackSize())); else if (imp.getNSlices()>1) return (int)(n*((double)(imp.getNSlices())/imp.getStackSize())); else return n; }
private void syncWindows(Object source) { if (SyncWindows.getInstance()==null) return; if (source==cSelector) SyncWindows.setC(this, cSelector.getValue()); else if (source==zSelector) { int stackSize = imp.getStackSize(); if (imp.getNChannels()==stackSize) SyncWindows.setC(this, zSelector.getValue()); else if (imp.getNFrames()==stackSize) SyncWindows.setT(this, zSelector.getValue()); else SyncWindows.setZ(this, zSelector.getValue()); } else if (source==tSelector) SyncWindows.setT(this, tSelector.getValue()); else throw new RuntimeException("Unknownsource:"+source); }
private void setDefaultBounds() { int stackSize = imp.getStackSize(); int channels = imp.getNChannels(); int frames = imp.getNFrames(); int slices = imp.getNSlices(); isHyperstack = imp.isHyperStack()||( ij.macro.Interpreter.isBatchMode()&&((frames>1&&frames<stackSize)||(slices>1&&slices<stackSize))); simpleComposite = channels==stackSize; if (simpleComposite) isHyperstack = false; startSlice = 1; if (isHyperstack) { int nSlices = imp.getNSlices(); if (nSlices>1) stopSlice = nSlices; else stopSlice = imp.getNFrames(); } else stopSlice = stackSize; }
int updateIndex(int n) { if (imp.getNFrames()>1) return (int)(n*((double)(imp.getNFrames())/imp.getStackSize())); else if (imp.getNSlices()>1) return (int)(n*((double)(imp.getNSlices())/imp.getStackSize())); else return n; }
private void syncWindows(Object source) { if (SyncWindows.getInstance()==null) return; if (source==cSelector) SyncWindows.setC(this, cSelector.getValue()); else if (source==zSelector) { int stackSize = imp.getStackSize(); if (imp.getNChannels()==stackSize) SyncWindows.setC(this, zSelector.getValue()); else if (imp.getNFrames()==stackSize) SyncWindows.setT(this, zSelector.getValue()); else SyncWindows.setZ(this, zSelector.getValue()); } else if (source==tSelector) SyncWindows.setT(this, tSelector.getValue()); else throw new RuntimeException("Unknownsource:"+source); }
public String toString() { return "img[\""+getTitle()+"\" ("+getID()+"), "+getBitDepth()+"-bit, "+width+"x"+height+"x"+getNChannels()+"x"+getNSlices()+"x"+getNFrames()+"]"; }
/** * Checks if image to be analyzed is valid. * * @param imp * the image being analyzed * @return true, if valid (8/16 bit, 2D/3D, single or multi-channel) */ public boolean validateImage(final ImagePlus imp) { return (imp != null && imp.getBitDepth() < 24 && imp.getNDimensions() <= 4 && !(imp.getNSlices() > 1 && imp.getNFrames() > 1)); }
private Overlay projectHyperStackRois(Overlay overlay) { if (overlay==null) return null; int t1 = imp.getFrame(); int channels = projImage.getNChannels(); int slices = 1; int frames = projImage.getNFrames(); Overlay overlay2 = overlay.create(); Roi roi;
public String toString() { return "img[\""+getTitle()+"\" ("+getID()+"), "+getBitDepth()+"-bit, "+width+"x"+height+"x"+getNChannels()+"x"+getNSlices()+"x"+getNFrames()+"]"; }
public static float[] computeMinMax( final ImagePlus imp, final int channel ) { final int size = imp.getWidth() * imp.getHeight(); float min = Float.MAX_VALUE; float max = -Float.MAX_VALUE; IJ.log( "Computing min/max over " + imp.getNSlices() + " slices and " + imp.getNFrames() + " frames for channel " + channel ); for ( int z = 0; z < imp.getNSlices(); ++z ) for ( int t = 0; t < imp.getNFrames(); ++t ) { final ImageProcessor ip = imp.getStack().getProcessor( imp.getStackIndex( channel, z + 1, t + 1 ) ); for ( int i = 0; i < size; ++i ) { final float f = ip.getf( i ); min = Math.min( min, f ); max = Math.max( max, f ); } } return new float[]{ min, max }; }