protected ImagePlusImg( final int width, final int height, final int depth, final int frames, final int channels, final int entitiesPerPixel ) { super( reduceDimensions( new long[] { width, height, channels, depth, frames } ), entitiesPerPixel ); this.width = width; this.height = height; this.depth = depth; this.frames = frames; this.channels = channels; }
/** * Compute the minimal required number of dimensions for a given * {@link ImagePlus}, whereas width and height are always first. * * E.g. a gray-scale 2d time series would have three dimensions * [width,height,frames], a gray-scale 3d stack [width,height,depth] and a * 2d composite image [width,height,channels] as well. A composite 3d * stack has four dimensions [width,height,channels,depth], as a time * series five [width,height,channels,depth,frames]. */ protected static long[] reduceDimensions( final ImagePlus imp ) { final int[] dimensions = imp.getDimensions(); final long[] impDimensions = new long[ dimensions.length ]; for ( int d = 0; d < dimensions.length; ++d ) impDimensions[ d ] = dimensions[ d ]; return reduceDimensions( impDimensions ); }