Posted by
Michael Schmid on
URL: http://imagej.273.s1.nabble.com/Image-ID-increment-value-when-image-cropped-tp5017411p5017415.html
Hi Matt,
sorry, I can't reproduce the problem. Try the following macro:
//run("HeLa Cells (1.3M, 48-bit RGB)");
run("Clown (14K)");
getImageID();
makeRectangle(114, 66, 50, 38);
run("Crop");
getImageID();
run("Split Channels");
//selectWindow("C1-hela-cells.tif");
selectWindow("clown.jpg (red)");
getImageID();
It's the same for the 'Clown' (RGB) and 'HeLa Cells' (Composite) images,
the first image after splitting gets the first free ID, i.e., the ID of
the image just opened before minus one.
Of course, if there is some step creating an ImagePlus between opening
the original image and 'Split Channels', the imageID of the result will
be lower.
So, if you cannot exclude that an image will be generated in between, it
would be better to select the results of the 'split' operation by the
new window title, which is the old title plus " (red)" etc. for RGB
images, and "C"+the channel number (starting with 1)+"-"+the title for
composite images.
Michael
________________________________________________________________
On 18 Oct 2016, at 15:43, PEARSON Matthew wrote:
>
> Hi all,
>
> I was wondering if any one knows why when you split channels on a
> cropped image the ID number of the first split channel is 1st channel
> ID = cropped image ID - 2. If i didn't crop the image the first
> split channel has ID original - 1.
>
> This is having some implications for me in a macro whereby ideally
> the user can run it on the whole image or crop to an ROI first.
> However my loop to determine channel id's of windows once it's split
> channels is messed up if they crop first as the ID of the first
> channel jumps -2 instead of -1!
>
> I'm sure this is probably intentional behaviour and if so i will
> create some extra lines to deal with this potential change.
>
> Thanks for the help,
>
> Matt
>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html