http://imagej.273.s1.nabble.com/selectWindow-does-not-work-tp5022577p5022596.html
may I please ask you to consider the whole thread.
Yours as others comments are only partially to the point.
problem step by step. The "weird prefix" is not the OP's fault but, as I
assume, an annoying inconsistency of "Bio-Formats Importer".
> Hi Kefe.
> Despite I do not understand the weird prefix naming, I would like to put
> some intro into naming anyway.
>
> You got this error, because no active image with this name is open. Herbies
> code "hide" the suffix (e.g. .tif), which would be the problem. He has
> split the title into the array "nme" consisting of element 0 = "filename"
> and 1 = ".tif" (suffix). If you want to concatenate this with hard coded
> prefix you have to do it like this:
>
> imgName="c:1/2 - "+nme[0]+nme[1] //in case you want to include suffix
>
> this is equivalent:
> title=getTitle();
> run("Split Channels"); //or whatever split function you use
> selectWindow("C1-"+title); //or whatever suffix you need - just exchange
> "C1-" with "your_preffix". This just should work.
>
> Anyway, more "safe" would be collect resulting images names and use them
> e.g. in array. Here is an example code:
>
>
> //open("/home/schebique/Obrázky/A1/confocal-series.tif");
> run("Confocal Series (2.2MB)");
> nI_pre=nImages; //actual number of opened image windows
>
> run("Split Channels"); //splitting channels resulting in
> C1-confocal-series.tif etc.
> nI_post=nImages; //number of images after splitting
> newImagesCount=nI_post - nI_pre +1; //+1 because original was closed, but
> we have one image more after split
> img=newArray(newImagesCount); //new array where we will collect image titles
> count=0; //counter for the array index
> for (n=nI_pre; n<=nI_post; n++) { //loop through desired images
> selectImage(n); //selecting image
> img[count]=getTitle(); //getting title into the array
> count++; //index counter increment
> }
>
> //loop for printing
> for (a=0; a<img.length; a++) {
> print(img[a]);
> }
> //direct selecti of new channel images
> selectWindow(img[0]); //select C1
> selectWindow(img[1]); //select C2
> //example how to copy into the parameter:
> C1=img[0]; //params could be more intuitive furthur in the code
> C2=img[1];
> //loop for close new windows only
> for (a=0; a<img.length; a++) {
> selectImage(img[a]);
> close();
> }
>
> Just to be complete I usualy use a little different way to separate name
> from .tif suffix:
> title=getTitle();
> name=replace(title, ".tif", "");
> print(title+"\n"+name);
>
> Hopefully you can find some inspiration.
> Best Ondrej
>
>
>
> po 28. 10. 2019 v 8:49 odesílatel kefe <
[hidden email]> napsal:
>
>> unfortunately not
>> I get the following errors:
>>
>> Error: "c:2/3 - 191024_xxx" not found in line 8
>> selectImage ( "c:2/3 - " + nme [ 0 <]> ) ;
>>
>>
>> Since I do not understand what exactly you do with those 3 lines I dont
>> know
>> what this error means.
>> (Sorry I am a total newbie to writing anything)
>>
>>
>>
>> --
>> Sent from:
http://imagej.1557.x6.nabble.com/>>
>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>>
>
>