/** * Constructor that builds up a VectorProcessor froma a stack of {@link FloatProcessor}s This is * the constructor that is being used in @link{KMeans} * * @param stack a stack of {@link FloatProcessor}s. */ public VectorProcessor(final ImageStack stack) { /* Calls the constructor @link{VectorProcessor(final int width, final int height, final int numberOfValues)}*/ this(stack.getWidth(), stack.getHeight(), stack.getSize()); /* Gets the images in the stack and puts them into an array of Object*/ final Object[] slices = stack.getImageArray(); /* For each image (= component) in the stack */ for (int i = 0; i < numberOfValues; ++i) { /* get the pixels as an array of float */ final float[] values = (float[]) slices[i]; /* for each pixel */ for (int j = 0; j < values.length; j++) { /* store the value */ pixels[j][i] = values[j]; } } }