macro to batch auto adjust levels

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

macro to batch auto adjust levels

Uknalis, Joseph-2
Hey folks-

I'm trying to write this script but it does not work & I'm not versed enough to see the errors.

  dir1 = getDirectory("Choose Source Directory ");

  dir2 = getDirectory("Choose Destination Directory ");
  list = getFileList(dir1);
  setBatchMode(true);
  for (i=0; i<list.length; i++) {
     showProgress(i+1, list.length);
     open(dir1+list[i]);
     close();
  }

// Resets the display range of the current
// image so it is the same is the pixel
// value range.
resetMinAndMax();
saveAs(<format>, dir2+list[i]);
close();
  }

or is there a way to add the desired macro to Process>BATCH> MACRO drop down list??

  thanks

Joe





This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: macro to batch auto adjust levels

Cammer, Michael-3
These are old macros which may be clunky, but they might help, and the useful code could be used through the batch processing menu instead of full macros.


http://microscopynotes.com/imagej/macros/color_channels_macro_v100.txt

http://microscopynotes.com/imagej/macros/Convert_ND2_to_tif_whole_folder.txt


Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory

NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY  10016

[hidden email]<mailto:[hidden email]>  http://nyulmc.org/micros  http://microscopynotes.com/

Voice direct only, no text or messages:  1-914-309-3270 and 1-646-501-0567



________________________________
From: Uknalis, Joseph <[hidden email]>
Sent: Wednesday, April 22, 2020 10:09:30 AM
To: [hidden email]
Subject: macro to batch auto adjust levels

[EXTERNAL]

Hey folks-

I'm trying to write this script but it does not work & I'm not versed enough to see the errors.

  dir1 = getDirectory("Choose Source Directory ");

  dir2 = getDirectory("Choose Destination Directory ");
  list = getFileList(dir1);
  setBatchMode(true);
  for (i=0; i<list.length; i++) {
     showProgress(i+1, list.length);
     open(dir1+list[i]);
     close();
  }

// Resets the display range of the current
// image so it is the same is the pixel
// value range.
resetMinAndMax();
saveAs(<format>, dir2+list[i]);
close();
  }

or is there a way to add the desired macro to Process>BATCH> MACRO drop down list??

  thanks

Joe





This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.

--
ImageJ mailing list: https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwIFAw&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=hUBj2D5n6oKThx2L01qn8IORZb5f-ruLVXPmQ1zQNnM&m=yPt0U9q6trIF2AJV9USTj6_IFjgZJrCLJlGXbEcjMh0&s=Oq-hwUspVtmjotJNG1MA-2jctJ8xor67AgdxAlRCD-g&e=

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: macro to batch auto adjust levels

CARL Philippe (LBP)
In reply to this post by Uknalis, Joseph-2
Dear Joseph,
Give a try to the following modified macro code:
        dir1 = getDirectory("Choose Source Directory ");
        dir2 = getDirectory("Choose Destination Directory ");
        list = getFileList(dir1);
        setBatchMode(true);
        for (i=0; i<list.length; i++) {
                showProgress(i+1, list.length);
                open(dir1+list[i]);
                resetMinAndMax();
                saveAs("tiff", dir2+list[i]);
                close();
        }
I didn't try it (thus there may be some typo errors), but I think it will be doing what you were looking for.
My best regards,
Philippe

Philippe CARL
Laboratoire de Bioimagerie et Pathologies
UMR 7021 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 42 89

----- Le 22 Avr 20, à 16:09, Uknalis, Joseph [hidden email] a écrit :

Hey folks-

I'm trying to write this script but it does not work & I'm not versed enough to see the errors.

  dir1 = getDirectory("Choose Source Directory ");

  dir2 = getDirectory("Choose Destination Directory ");
  list = getFileList(dir1);
  setBatchMode(true);
  for (i=0; i<list.length; i++) {
     showProgress(i+1, list.length);
     open(dir1+list[i]);
     close();
  }

// Resets the display range of the current
// image so it is the same is the pixel
// value range.
resetMinAndMax();
saveAs(<format>, dir2+list[i]);
close();
  }

or is there a way to add the desired macro to Process>BATCH> MACRO drop down list??

  thanks

Joe





This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html