DaleMoulding / Fiji-Macros

Published Macros for image analysis & utilities for scalebars (ICH microscopes) & automating standard tasks. All are covered under an MIT License, so can be freely used and distributed.
MIT License
3 stars 0 forks source link

Adapting the code #1

Open Javiro94 opened 2 years ago

Javiro94 commented 2 years ago

Hello! I am adapting the code that you have here. Really nice one. I make it simple, just with three maginications. So I have modified it. Instead of the microscopes, this one. The problem is that it doesnt work and it keeps showing error. I dont know what more to look at. if (Microscope=="Medium") {

run("Set Scale...", "distance="2474" known="1000" unit=um");
if (scalebar=="Yes") {
    run("Remove Overlay");// removes any previously added scalebar
    run("Scale Bar...", "width=x height=h font=f color="+colour+" background=None location=[Lower Right] bold "+showtext+" overlay");
}
 // save as either a new file with -scalebar added to the ned of the name, or with the same name as the original file. 
// put // at the start of the unwated save option.
// saveAs("Tif", dir2+Imagename+"-scalebar");//saves the image to output folder with -scalebar added to the name
 save(savepath);//saves the image to output folder and over writes the original files if the input and output folder are the same

}

if (Microscope=="High") {

run("Set Scale...", "distance="619" known="100" unit=um");
if (scalebar=="Yes") {
    run("Remove Overlay");// removes any previously added scalebar
    run("Scale Bar...", "width=x height=h font=f color="+colour+" background=None location=[Lower Right] bold "+showtext+" overlay");
}
 // save as either a new file with -scalebar added to the ned of the name, or with the same name as the original file. 
// put // at the start of the unwated save option.
// saveAs("Tif", dir2+Imagename+"-scalebar");//saves the image to output folder with -scalebar added to the name
 save(savepath);//saves the image to output folder and over writes the original files if the input and output folder are the same

}

if (Microscope=="Super High") {

run("Set Scale...", "distance="991" known="100" unit=um");
if (scalebar=="Yes") {
    run("Remove Overlay");// removes any previously added scalebar
    run("Scale Bar...", "width=x height=h font=f color="+colour+" background=None location=[Lower Right] bold "+showtext+" overlay");
}
 // save as either a new file with -scalebar added to the ned of the name, or with the same name as the original file. 
// put // at the start of the unwated save option.
// saveAs("Tif", dir2+Imagename+"-scalebar");//saves the image to output folder with -scalebar added to the name
 save(savepath);//saves the image to output folder and over writes the original files if the input and output folder are the same

}

DaleMoulding commented 2 years ago

Hi Javiro,

i've not had an email from Github? before, not sure if this will get back to you. You need to include the beginning of the macro also, to tell it the microscope type you want, and also before that to ask where your files are. The code you've included above won;t do anything without the first part. You'd also need to adjust the lines drawing the scale bars. If you wan't help with this you could contact me at work: @.*** I'm pretty busy but this should be simple to set up.

cheers

Dale

On Wed, Mar 2, 2022 at 2:58 PM Javiro94 @.***> wrote:

Hello! I am adapting the code that you have here. Really nice one. I make it simple, just with three maginications. So I have modified it. Instead of the microscopes, this one. The problem is that it doesnt work and it keeps showing error. I dont know what more to look at. if (Microscope=="Medium") {

run("Set Scale...", "distance="2474" known="1000" unit=um"); if (scalebar=="Yes") { run("Remove Overlay");// removes any previously added scalebar run("Scale Bar...", "width=x height=h font=f color="+colour+" background=None location=[Lower Right] bold "+showtext+" overlay"); } // save as either a new file with -scalebar added to the ned of the name, or with the same name as the original file. // put // at the start of the unwated save option. // saveAs("Tif", dir2+Imagename+"-scalebar");//saves the image to output folder with -scalebar added to the name save(savepath);//saves the image to output folder and over writes the original files if the input and output folder are the same

}

if (Microscope=="High") {

run("Set Scale...", "distance="619" known="100" unit=um"); if (scalebar=="Yes") { run("Remove Overlay");// removes any previously added scalebar run("Scale Bar...", "width=x height=h font=f color="+colour+" background=None location=[Lower Right] bold "+showtext+" overlay"); } // save as either a new file with -scalebar added to the ned of the name, or with the same name as the original file. // put // at the start of the unwated save option. // saveAs("Tif", dir2+Imagename+"-scalebar");//saves the image to output folder with -scalebar added to the name save(savepath);//saves the image to output folder and over writes the original files if the input and output folder are the same

}

if (Microscope=="Super High") {

run("Set Scale...", "distance="991" known="100" unit=um"); if (scalebar=="Yes") { run("Remove Overlay");// removes any previously added scalebar run("Scale Bar...", "width=x height=h font=f color="+colour+" background=None location=[Lower Right] bold "+showtext+" overlay"); } // save as either a new file with -scalebar added to the ned of the name, or with the same name as the original file. // put // at the start of the unwated save option. // saveAs("Tif", dir2+Imagename+"-scalebar");//saves the image to output folder with -scalebar added to the name save(savepath);//saves the image to output folder and over writes the original files if the input and output folder are the same

}

— Reply to this email directly, view it on GitHub https://github.com/DaleMoulding/Fiji-Macros/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMG4ENWTBZXLV5UPIAJSHDDU556XRANCNFSM5PXWII6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

Javiro94 commented 2 years ago

Thanks for your reply Dale!

I can imagine how busy you are, so first, thanks a lot for it!

After a couple of hours more, I managed to solve my problem. The only issue now is that I can just work with 4 images at a time because of the memory of ImageJ. But well, that’s another issue!

Thanks!!

From: DaleMoulding @.> Sent: 08 March 2022 11:15 To: DaleMoulding/Fiji-Macros @.> Cc: Javiro94 @.>; Author @.> Subject: Re: [DaleMoulding/Fiji-Macros] Adapting the code (Issue #1)

Hi Javiro,

i've not had an email from Github? before, not sure if this will get back to you. You need to include the beginning of the macro also, to tell it the microscope type you want, and also before that to ask where your files are. The code you've included above won;t do anything without the first part. You'd also need to adjust the lines drawing the scale bars. If you wan't help with this you could contact me at work: @.<mailto:@.> I'm pretty busy but this should be simple to set up.

cheers

Dale

On Wed, Mar 2, 2022 at 2:58 PM Javiro94 @.<mailto:@.>> wrote:

Hello! I am adapting the code that you have here. Really nice one. I make it simple, just with three maginications. So I have modified it. Instead of the microscopes, this one. The problem is that it doesnt work and it keeps showing error. I dont know what more to look at. if (Microscope=="Medium") {

run("Set Scale...", "distance="2474" known="1000" unit=um"); if (scalebar=="Yes") { run("Remove Overlay");// removes any previously added scalebar run("Scale Bar...", "width=x height=h font=f color="+colour+" background=None location=[Lower Right] bold "+showtext+" overlay"); } // save as either a new file with -scalebar added to the ned of the name, or with the same name as the original file. // put // at the start of the unwated save option. // saveAs("Tif", dir2+Imagename+"-scalebar");//saves the image to output folder with -scalebar added to the name save(savepath);//saves the image to output folder and over writes the original files if the input and output folder are the same

}

if (Microscope=="High") {

run("Set Scale...", "distance="619" known="100" unit=um"); if (scalebar=="Yes") { run("Remove Overlay");// removes any previously added scalebar run("Scale Bar...", "width=x height=h font=f color="+colour+" background=None location=[Lower Right] bold "+showtext+" overlay"); } // save as either a new file with -scalebar added to the ned of the name, or with the same name as the original file. // put // at the start of the unwated save option. // saveAs("Tif", dir2+Imagename+"-scalebar");//saves the image to output folder with -scalebar added to the name save(savepath);//saves the image to output folder and over writes the original files if the input and output folder are the same

}

if (Microscope=="Super High") {

run("Set Scale...", "distance="991" known="100" unit=um"); if (scalebar=="Yes") { run("Remove Overlay");// removes any previously added scalebar run("Scale Bar...", "width=x height=h font=f color="+colour+" background=None location=[Lower Right] bold "+showtext+" overlay"); } // save as either a new file with -scalebar added to the ned of the name, or with the same name as the original file. // put // at the start of the unwated save option. // saveAs("Tif", dir2+Imagename+"-scalebar");//saves the image to output folder with -scalebar added to the name save(savepath);//saves the image to output folder and over writes the original files if the input and output folder are the same

}

— Reply to this email directly, view it on GitHub https://github.com/DaleMoulding/Fiji-Macros/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMG4ENWTBZXLV5UPIAJSHDDU556XRANCNFSM5PXWII6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.<mailto:@.>>

— Reply to this email directly, view it on GitHubhttps://github.com/DaleMoulding/Fiji-Macros/issues/1#issuecomment-1061668264, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYA5PJ2R57RV4VE5VZ7FYODU64ZD3ANCNFSM5PXWII6Q. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.**@.>>