imagej / ImageJ

Public domain software for processing and analyzing scientific images
http://imagej.org
Other
576 stars 227 forks source link

looks like array indexes are incorrect: #224

Closed scuniff closed 1 year ago

scuniff commented 1 year ago

In Concatenator.java (https://github.com/imagej/ImageJ/blob/master/ij/plugin/Concatenator.java)

There are 2 lines of code where it looks like the array indexes are incorrect:

public static ImagePlus run(ImagePlus img1, ImagePlus img2, ImagePlus img3, ImagePlus img4) {
    ImagePlus[] images = new ImagePlus[4];
    images[0]=img1; images[1]=img2;  images[2]=img3; images[2]=img4;
    return (new Concatenator()).concatenate(images, false);
}

/** Concatenates five images, stacks or hyperstacks. */
public static ImagePlus run(ImagePlus img1, ImagePlus img2, ImagePlus img3, ImagePlus img4, ImagePlus img5) {
    ImagePlus[] images = new ImagePlus[5];
    images[0]=img1; images[1]=img2;  images[2]=img3; images[2]=img4; images[5]=img5;
    return (new Concatenator()).concatenate(images, false);
}

The line of code:

         images[0]=img1; images[1]=img2;  images[2]=img3; images[2]=img4;

should be

    images[0]=img1; images[1]=img2;  images[2]=img3; images[3]=img4;

and…..

    images[0]=img1; images[1]=img2;  images[2]=img3; images[2]=img4; images[5]=img5;

should be

    images[0]=img1; images[1]=img2;  images[2]=img3; images[3]=img4; images[4]=img5;
rasband commented 1 year ago

These bug fixes are in the ImageJ 1.54g15 daily build. The commit is at https://github.com/imagej/ImageJ/commit/53b0f93d34cd8ce2ca25c6f68f63d8fd85ab5c61.