Apply "Substract background" to all files in subfolders

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

Apply "Substract background" to all files in subfolders

Dominik Geisel
Hi all!

I want to apply the "Process -> Subtract Background" to all files in
multiple subfolders automatically. Working with stacks brings up RAM
problems and is just for one folder - so is there a smarter and faster way?

Thank you very much!
Dominik
Reply | Threaded
Open this post in threaded view
|

Re: Apply "Substract background" to all files in subfolders

John Bradley
Dominik,
 I wanted to do the same procedure as you describe. I couldn't get ImageJ to
do it so I tried Metamorph (Universal Imaging) - it doesn't have this
functionality either. My solution was Photoshop with Fovea3 plug-ins
(Reindeer graphics: http://www.reindeergraphics.com/free.shtml). Record the
process you wish to automate using 'Actions', then under the File menu
choose 'Process' and then 'Batch'. In the dialogue box click the checkbox
for 'include subdirectories'.
 If anyone knows of a macro for ImageJ that will process through all
subdirectories I too would be very interested.
 Cheers, John
       -------------------
John Bradley
Scientist, Morphology
Eyetech Pharmaceuticals, Inc.
Eyetech Research Center
35 Hartwell Avenue
Lexington, MA. 02421-3102
Tel. (781) 259-7055
Fax: (781) 676-7757
[hidden email]
www.eyetech.com <http://www.eyetech.com>
     On 7/20/05, Dominik Geisel <[hidden email]> wrote:

>
> Hi all!
>
> I want to apply the "Process -> Subtract Background" to all files in
> multiple subfolders automatically. Working with stacks brings up RAM
> problems and is just for one folder - so is there a smarter and faster
> way?
>
> Thank you very much!
> Dominik
>



--
-------------------
John Bradley
Scientist, Morphology
Eyetech Pharmaceuticals, Inc.
Eyetech Research Center
35 Hartwell Avenue
Lexington, MA. 02421-3102
Tel. (781) 259-7055
Fax: (781) 676-7757
[hidden email]
www.eyetech.com <http://www.eyetech.com/>
Reply | Threaded
Open this post in threaded view
|

How to know the file name?

Marco Brugnara
In reply to this post by Dominik Geisel
Dear all,
I'd like to apologize if my question will sound too basic, just Im really a
newbie in Java.
Within a plugin I would like to add the file name as label in the results
table. For all the other values I use simply the command, for instance
rt.addValue("Scarto:", scrt);

In the result table the column label is already present just it remains
empty, I dont know because I've never assigned this variable, or because I'm
working on a layer created over the original image. How can i manage in
order to obtain the filename in this column?
Thank you very much and best regards,
Marco
Reply | Threaded
Open this post in threaded view
|

input problem

quantumlottie
Hello


Sorry This isn't really an image problem but I'm using imagej and I can't get this to work.
I'm trying to get the user to input a name which the file the programe will go on to create will be named. I just want a box to pop up asking for the name to be typed in by the user and then that name kept and then used as the title.


I am using: System.out.println("What is the name?");
                    String userName = System.in.readln();

however it keeps coming up with an error: Method readln() not found in class java.io.InputStream.

Does this mean I need to add a package which will let me do this? Am I usingthe wrong command?

Lottie


========================================================================
http://www.international-marine.com   International Marine Coatings.
http://www.international-pc.com       International Protective Coatings.
http://www.yachtpaint.com             International Yacht Coatings.
========================================================================
Confidentiality Note:

This message, including attachments, is confidential and
may be privileged. If you are not an intended recipient,
please notify the sender then delete and destroy the original
message and all copies. You should not copy, forward
and/or disclose this message, in whole or in part, without
permission of the sender. If you receive this e-mail message
in error please notify us immediately by e-mail at [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: How to know the file name?

Sullivan, Michael J (College of Med.)
In reply to this post by Marco Brugnara
Marco, assuming you have the filename as a String you can use the
addLable(...) command. Below is a couple of lines from my current
project to do this.  If you need a more-in-depth explanation, please let
me know. --- Mike

resultsTable.setHeading(0, "File Name");
resultsTable.addLabel("File Name", imgFileName);
 

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
Marco Brugnara
Sent: Wednesday, July 20, 2005 9:10 AM
To: [hidden email]
Subject: How to know the file name?

Dear all,
I'd like to apologize if my question will sound too basic, just Im
really a newbie in Java.
Within a plugin I would like to add the file name as label in the
results table. For all the other values I use simply the command, for
instance rt.addValue("Scarto:", scrt);

In the result table the column label is already present just it remains
empty, I dont know because I've never assigned this variable, or because
I'm working on a layer created over the original image. How can i manage
in order to obtain the filename in this column?
Thank you very much and best regards,
Marco
Reply | Threaded
Open this post in threaded view
|

Re: input problem

Kurt De Vos
In reply to this post by quantumlottie
Dear Charlotte,

It means what it says, the readln() method does not exist in InputStream.
you can use the IJ.getString(prompt, defaultString); method from ij to
get a String.

kurt

Holmes, Charlotte wrote:

>Hello
>
>
>Sorry This isn't really an image problem but I'm using imagej and I can't get this to work.
>I'm trying to get the user to input a name which the file the programe will go on to create will be named. I just want a box to pop up asking for the name to be typed in by the user and then that name kept and then used as the title.
>
>
>I am using: System.out.println("What is the name?");
>                    String userName = System.in.readln();
>
>however it keeps coming up with an error: Method readln() not found in class java.io.InputStream.
>
>Does this mean I need to add a package which will let me do this? Am I usingthe wrong command?
>
>Lottie
>
>
>========================================================================
>http://www.international-marine.com   International Marine Coatings.
>http://www.international-pc.com       International Protective Coatings.
>http://www.yachtpaint.com             International Yacht Coatings.
>========================================================================
>Confidentiality Note:
>
>This message, including attachments, is confidential and
>may be privileged. If you are not an intended recipient,
>please notify the sender then delete and destroy the original
>message and all copies. You should not copy, forward
>and/or disclose this message, in whole or in part, without
>permission of the sender. If you receive this e-mail message
>in error please notify us immediately by e-mail at [hidden email]
>  
>

--
*--*--*--*--*--*--*--*--*--*--*
University of Sheffield
Academic Neurology Unit
Division of Genomic Medicine
E Floor, Medical School
Beech Hill Road
Sheffield
S10 2RX
United Kingdom

Tel: ++44 (0) 114 271 2473
Fax: ++44 (0) 114 226 1201
Email: [hidden email]
*--*--*--*--*--*--*--*--*--*--*
Reply | Threaded
Open this post in threaded view
|

Re: Apply "Substract background" to all files in subfolders

Wayne Rasband
In reply to this post by Dominik Geisel
> I want to apply the "Process -> Subtract Background" to
> all files in multiple subfolders automatically. Working with
> stacks brings up RAM  problems and is just for one folder
> - so is there a smarter and faster way?

There is a macro at

    http://rsb.info.nih.gov/ij/macros/BatchProcessFolders.txt

that does this.

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: Apply "Substract background" to all files in subfolders

Dominik Geisel
In reply to this post by Dominik Geisel
Thanks, but which option in Fovea Pro 3 would replace "subtract
background" in ImageJ?
Reply | Threaded
Open this post in threaded view
|

results collection

quantumlottie
In reply to this post by quantumlottie
hello

is there any way of getting the data out of a "results" window using code not copy/paste? ie a plugin which can collect the data and then manipulate it.

Lottie

========================================================================
http://www.international-marine.com   International Marine Coatings.
http://www.international-pc.com       International Protective Coatings.
http://www.yachtpaint.com             International Yacht Coatings.
========================================================================
Confidentiality Note:

This message, including attachments, is confidential and
may be privileged. If you are not an intended recipient,
please notify the sender then delete and destroy the original
message and all copies. You should not copy, forward
and/or disclose this message, in whole or in part, without
permission of the sender. If you receive this e-mail message
in error please notify us immediately by e-mail at [hidden email]
Reply | Threaded
Open this post in threaded view
|

R:results collection

Marco Brugnara
On 21-07-2005 11:24, "Holmes, Charlotte"
<[hidden email]> wrote:

> hello
>
> is there any way of getting the data out of a "results" window using code not
> copy/paste? ie a plugin which can collect the data and then manipulate it.

As far I know, the result table could be saved as a .txt file and I often
use this option exporting my results.

Instead I use your message for another general request: it would be nice to
load a previous saved result table in order to continue adding new data in
the same file. Is already present this option in ImageJ?
Best regards,
Marco
Reply | Threaded
Open this post in threaded view
|

Re: Apply "Substract background" to all files in subfolders

Tony Collins-2
In reply to this post by Dominik Geisel
It depends on how you wish to "subtract background". How does Fovea Pro
do it?

For uneven background you should use the menu command "Process/Subtract
Background". This "rolling ball algorithm" produces nice results but is
computationally intense and quite slow.

Other algorithms for BG subtraction use the mean of a user defined ROI
as a measure of BG. Although this may not be suitable for batch processing.

If you wish to merely subtract the minimum intensity in the image, then
you may need to write some macro code for this. Have a look at he
getStatistics() macro function.

Regards,

Tony

Dominik Geisel wrote:

> Thanks, but which option in Fovea Pro 3 would replace "subtract
> background" in ImageJ?

--
Tony Collins, Ph.D.
Facility Manager
Wright Cell Imaging Facility
Toronto Western Research Institute
13-407 McLaughlin Pavilion
399 Bathurst Street
Toronto, ON. M5T 2S8
tel. (416) 603 5367 fax: (416) 603 5745
http://www.uhnresearch.ca/wcif

UHN Disclaimer: This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Opinions, conclusions or other information expressed or contained in this e-mail are not given or endorsed by the sender unless otherwise affirmed independently by the sender.  If you have questions about this disclaimer please call the University Health Network Privacy Office (416)340-4800 x 6799.
Reply | Threaded
Open this post in threaded view
|

Re: results collection

Sullivan, Michael J (College of Med.)
In reply to this post by quantumlottie
Lottie, a good example of the code you seek can be found in the
Area_Calculator plugin; available at:
http://rsb.info.nih.gov/ij/plugins/area.html

--- Mike

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
Holmes, Charlotte
Sent: Thursday, July 21, 2005 5:24 AM
To: [hidden email]
Subject: results collection

hello

is there any way of getting the data out of a "results" window using
code not copy/paste? ie a plugin which can collect the data and then
manipulate it.

Lottie

========================================================================
http://www.international-marine.com   International Marine Coatings.
http://www.international-pc.com       International Protective Coatings.
http://www.yachtpaint.com             International Yacht Coatings.
========================================================================
Confidentiality Note:

This message, including attachments, is confidential and may be
privileged. If you are not an intended recipient, please notify the
sender then delete and destroy the original message and all copies. You
should not copy, forward and/or disclose this message, in whole or in
part, without permission of the sender. If you receive this e-mail
message in error please notify us immediately by e-mail at
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: results collection

Brent Wood
In reply to this post by quantumlottie
On Thu, 21 Jul 2005, Holmes, Charlotte wrote:

> hello
>
> is there any way of getting the data out of a "results" window using
> code not copy/paste? ie a plugin which can collect the data and then
> manipulate it.
>

Hi Lottie,

I've applied for some funding (don't know if it will approved) to help
fund the development of a plugin which can save such data to a database,
probably via JDBC.

If you get any feedback on anything like this, could you let me know?

Or anyone else with an interest in such a capability.

Thanks,

  Brent
Reply | Threaded
Open this post in threaded view
|

Re: Apply "Substract background" to all files in subfolders

Dominik Geisel
In reply to this post by Dominik Geisel
Thanks for the macro!

It stops when it finds a file which is not an image in a subdirectory and
displays an appropriate error message (I have some ZIP files in
subdirectories).
Can I modify the macro in order to just let it handle .tiff and .tif files
for example?

Thanks!
Dominik
Reply | Threaded
Open this post in threaded view
|

Re: Apply "Substract background" to all files in subfolders

Wayne Rasband
> It stops when it finds a file which is not an image in a
> subdirectory  and  displays an appropriate error message
> (I have some ZIP files in  subdirectories).
> Can I modify the macro in order to just let it handle .tiff and
> .tif files for example?

You can modify the macro at
"http://rsb.info.nih.gov/ij/macros/BatchProcessFolders.txt" to handle
only .tif files by modifying the processFile() function as follows:

   function processFile(path) {
        if (endsWith(path, ".tif")) {
            open(path);
            run("Subtract Background...", "rolling=50 white");
            save(path);
            close();
       }
   }

The save() function appears to not work with files that have a ".tiff"
extension. You can use saveAs("tiff", path) but it changes the
extension from ".tiff" to ".tif".

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: Apply "Substract background" to all files in subfolders

Paxton Provitera
is there a function in the plugin language corresponding to "endsWith"?
 -Paxton

 On 7/22/05, Wayne Rasband <[hidden email]> wrote:

>
> > It stops when it finds a file which is not an image in a
> > subdirectory and displays an appropriate error message
> > (I have some ZIP files in subdirectories).
> > Can I modify the macro in order to just let it handle .tiff and
> > .tif files for example?
>
> You can modify the macro at
> "http://rsb.info.nih.gov/ij/macros/BatchProcessFolders.txt" to handle
> only .tif files by modifying the processFile() function as follows:
>
> function processFile(path) {
> if (endsWith(path, ".tif")) {
> open(path);
> run("Subtract Background...", "rolling=50 white");
> save(path);
> close();
> }
> }
>
> The save() function appears to not work with files that have a ".tiff"
> extension. You can use saveAs("tiff", path) but it changes the
> extension from ".tiff" to ".tif".
>
> -wayne
>
Reply | Threaded
Open this post in threaded view
|

Re: Apply "Substract background" to all files in subfolders

ctrueden
Hi Paxton,

>is there a function in the plugin language corresponding to "endsWith"?
>  
>

The "plugin language" is just Java, so use String.endsWith(String).

-Curtis
Reply | Threaded
Open this post in threaded view
|

Re: results collection, (also info for brent wood)

quantumlottie
In reply to this post by quantumlottie
I don't know about databases but i've downloaded a package which allows me to manipulate an excel spreadsheet from code. jexcelapi. I use it to open a template spreadsheet and insert my data, then save it as another name so I don't need to copy and paste results.
I can do this only from a plugin which is why i needed to know how to get the results out of a "results" window so I can use them in a plugin which outputs them into excel.

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]]On Behalf Of
Brent Wood
Sent: 21 July 2005 23:33
To: [hidden email]
Subject: Re: results collection


On Thu, 21 Jul 2005, Holmes, Charlotte wrote:

> hello
>
> is there any way of getting the data out of a "results" window using
> code not copy/paste? ie a plugin which can collect the data and then
> manipulate it.
>

Hi Lottie,

I've applied for some funding (don't know if it will approved) to help
fund the development of a plugin which can save such data to a database,
probably via JDBC.

If you get any feedback on anything like this, could you let me know?

Or anyone else with an interest in such a capability.

Thanks,

  Brent

========================================================================
http://www.international-marine.com   International Marine Coatings.
http://www.international-pc.com       International Protective Coatings.
http://www.yachtpaint.com             International Yacht Coatings.
========================================================================
Confidentiality Note:

This message, including attachments, is confidential and
may be privileged. If you are not an intended recipient,
please notify the sender then delete and destroy the original
message and all copies. You should not copy, forward
and/or disclose this message, in whole or in part, without
permission of the sender. If you receive this e-mail message
in error please notify us immediately by e-mail at [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: results collection, (also info for brent wood)

Kurt De Vos
Have a look at ExcelWriter which uses POI instead of jexcelapi but will
give you an example.
kurt

Holmes, Charlotte wrote:

>I don't know about databases but i've downloaded a package which allows me to manipulate an excel spreadsheet from code. jexcelapi. I use it to open a template spreadsheet and insert my data, then save it as another name so I don't need to copy and paste results.
>I can do this only from a plugin which is why i needed to know how to get the results out of a "results" window so I can use them in a plugin which outputs them into excel.
>
>-----Original Message-----
>From: ImageJ Interest Group [mailto:[hidden email]]On Behalf Of
>Brent Wood
>Sent: 21 July 2005 23:33
>To: [hidden email]
>Subject: Re: results collection
>
>
>On Thu, 21 Jul 2005, Holmes, Charlotte wrote:
>
>  
>
>>hello
>>
>>is there any way of getting the data out of a "results" window using
>>code not copy/paste? ie a plugin which can collect the data and then
>>manipulate it.
>>
>>    
>>
>
>Hi Lottie,
>
>I've applied for some funding (don't know if it will approved) to help
>fund the development of a plugin which can save such data to a database,
>probably via JDBC.
>
>If you get any feedback on anything like this, could you let me know?
>
>Or anyone else with an interest in such a capability.
>
>Thanks,
>
>  Brent
>
>========================================================================
>http://www.international-marine.com   International Marine Coatings.
>http://www.international-pc.com       International Protective Coatings.
>http://www.yachtpaint.com             International Yacht Coatings.
>========================================================================
>Confidentiality Note:
>
>This message, including attachments, is confidential and
>may be privileged. If you are not an intended recipient,
>please notify the sender then delete and destroy the original
>message and all copies. You should not copy, forward
>and/or disclose this message, in whole or in part, without
>permission of the sender. If you receive this e-mail message
>in error please notify us immediately by e-mail at [hidden email]
>  
>

--
*--*--*--*--*--*--*--*--*--*--*
University of Sheffield
Academic Neurology Unit
Division of Genomic Medicine
E Floor, Medical School
Beech Hill Road
Sheffield
S10 2RX
United Kingdom

Tel: ++44 (0) 114 271 2473
Fax: ++44 (0) 114 226 1201
Email: [hidden email]
*--*--*--*--*--*--*--*--*--*--*