Re: Batch processing of .oib

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

Re: Batch processing of .oib

Daniel James White
Sam,

post this problem to the ImageJ list, and someone will probably answer.

if you get the Fiji distro of imageJ....
http://pacific.mpi-cbg.de/
there is a built in script editor that will help you fix this stuff  
more easily,
the docs are on the same website as the download.
Fiji is just ImageJ, batteries included.

The script editor does the image J macro language as well as nicer  
modern scripting languages like python and ruby that are much more  
powerful than the macro lang.

cheers

Dan


On Mar 2, 2010, at 7:07 AM, CONFOCALMICROSCOPY automatic digest system  
wrote:

> Date:    Mon, 1 Mar 2010 13:13:34 -0800
> From:    Sam Albers <[hidden email]>
> Subject: Batch processing of .oib
>
> --0016369205f6ce1a1a0480c3b8f1
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hello all,
>
> I am trying to batch process some .oib files into .tiff files using  
> the
> hyperstack projection macro for imagej (
> http://bipl.umn.edu/files/hyperstack_projection.txt).
>
> The difference with my .oib files is that they aren't stacks and  
> thus z
> always equals zero. When I try to run the macros on one of my files I
> received the error message "This command requires a stack".
>
> If I comment out the following from the macro I received a message  
> that no
> images are open:
>
>    // run the max intensity z projection
>    //run("Z Project...", "projection=[Max Intensity]");
>
>    // after the projection the file is now a stack
>    // made up of the different channels
>    // seperate and save
>    run("Image Sequence... ", "format=TIFF save=[" + path2 + "]  
> save=[" +
> path2 + "]");
>
>
> What I would like to do is process a bunch of .oib files with 3  
> channels
> into a single composite .tiff image. However, when I look through  
> the macros
> it is not entirely obvious to me which part specifies that the files  
> must be
> a stack so I'm not sure which part to change.
>
> Any help would be greatly appreciated. Sorry if this is extremely  
> simple.
> Thanks in advance.
>
> The reason that I am posting to this list rather than the imagej  
> list is
> because I first heard about the hyperstack projection macro on this  
> list.
>
> I am running Ubuntu 9.10 and Imagej 1.43b.
>
> Sam
>
>
>
> --
> *****************************************************
> Sam Albers
> Geography Program
> University of Northern British Columbia
> 3333 University Way
> Prince George, British Columbia
> Canada, V2N 4Z9
> phone: 250 960-6777

Dr. Daniel James White BSc. (Hons.) PhD
Senior Microscopist / Image Visualisation, Processing and Analysis
Light Microscopy and Image Processing Facilities
Max Planck Institute of Molecular Cell Biology and Genetics
Pfotenhauerstrasse 108
01307 DRESDEN
Germany

+49 (0)15114966933 (German Mobile)
+49 (0)351 210 2627 (Work phone at MPI-CBG)
+49 (0)351 210 1078 (Fax MPI-CBG LMF)

http://www.bioimagexd.net  BioImageXD
http://pacific.mpi-cbg.de                Fiji -  is just ImageJ (Batteries Included)
http://www.chalkie.org.uk                Dan's Homepages
https://ifn.mpi-cbg.de  Dresden Imaging Facility Network
dan (at) chalkie.org.uk
( white (at) mpi-cbg.de )
Reply | Threaded
Open this post in threaded view
|

Re: Batch processing of .oib

Sam Albers
Hello all,

Sorry for cross posting with the confocal list but it was suggested that I
look for an answer to my problem here.

I am trying to batch process some OIB files into TIFF files. I have a bunch
of OIB file without a z-series but with 3 separate channels. I would like to
produce a single TIFF file for each OIB file (i.e. overlay 3 channels into
one). I can easily do this manually but I have hundred of images and was
wondering if there is a way to do this more efficiently.

Have anyone ever batch processed OIB files without a z-series into single
TIFF files?

I am running Ubuntu 9.10 and Imagej 1.43b and am using the latest version of
LOCI.

Thanks in advance!

Sam

--
*****************************************************
Sam Albers
Geography Program
University of Northern British Columbia
3333 University Way
Prince George, British Columbia
Canada, V2N 4Z9
phone: 250 960-6777
*****************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Batch processing of .oib

ctrueden
Hi Sam,

Check out the "recursive TIFF converter" macro on the Bio-Formats web site:

https://skyking.microscopy.wisc.edu/trac/java/browser/trunk/components/loci-plugins/utils/macros/recursiveTiffConvert.txt

You will need to change the extension from "DM3" to "OIB" and tweak some of
the Bio-Formats Importer parameters on the line:
      run("Bio-Formats Importer", "id='" + inBase + path + "' view=[Standard
ImageJ] stackOrder=Default virtual");

You can determine the appropriate parameters by using the Macro Recorder,
opening one of your OIB files with the Bio-Formats Importer plugin, and then
copy/pasting the arguments into the macro. Specifically, to support the 3
channel overlay, you will probably want to check the "Merge channels to RGB"
option—something like:

run("Bio-Formats Importer", "open=[" + inBase + path + "] merge_channels
view=Hyperstack stack_order=XYCZT use_virtual_stack");

-Curtis

On Tue, Mar 2, 2010 at 1:02 PM, Sam Albers <[hidden email]>wrote:

> Hello all,
>
> Sorry for cross posting with the confocal list but it was suggested that I
> look for an answer to my problem here.
>
> I am trying to batch process some OIB files into TIFF files. I have a bunch
> of OIB file without a z-series but with 3 separate channels. I would like
> to
> produce a single TIFF file for each OIB file (i.e. overlay 3 channels into
> one). I can easily do this manually but I have hundred of images and was
> wondering if there is a way to do this more efficiently.
>
> Have anyone ever batch processed OIB files without a z-series into single
> TIFF files?
>
> I am running Ubuntu 9.10 and Imagej 1.43b and am using the latest version
> of
> LOCI.
>
> Thanks in advance!
>
> Sam
>
> --
> *****************************************************
> Sam Albers
> Geography Program
> University of Northern British Columbia
> 3333 University Way
> Prince George, British Columbia
> Canada, V2N 4Z9
> phone: 250 960-6777
> *****************************************************
>
Reply | Threaded
Open this post in threaded view
|

Re: Batch processing of .oib

Sam Albers
In reply to this post by Daniel James White
Hi Curtis,

Thanks for the response.

Your instructions make perfect sense. However, I am stalled by not actually
being able to get the LOCI plugin to do what I want. I would like to be able
to create a TIFF file that is exactly like the one produced when I export a
file from the Olympus viewer (File -> Export, file type=TIFF, output
format=RGB(using assigned LUT), and the "Merge Channel(Amount method)" box
checked).


I recorded the following macros in attempt to produce this same TIFF image
as above using LOCI in Image J. Any thoughts on how I might be able to use
LOCI to do the same as the Olympus software?

run("Bio-Formats Importer", "open=K:\\Confocal_test\\lectinsytoauto.oib
autoscale merge_channels display_metadata view=[Standard ImageJ]
stack_order=Default");
saveAs("Tiff", "K:\\Confocal_test\\lectinsytoauto.tif");

Thanks in advance.


Sam
Reply | Threaded
Open this post in threaded view
|

Re: Batch processing of .oib

Glen MacDonald-2
Dear Sam and Curtis,

 With the LOCI plugin, selecting to import Olympus  3-channel OIB or OIF into RGB merge, the result is 16-bit monochrome with interleaved channels.   Occurs with 'old'  files acquired by Fluoview pre-2.0 and with 2.0c.  

The Olympus viewer output for a 2D 3-channel OIB or OIF is a 24-bit color merge.  
Sam, the macro I sent to you uses the LOCI plugin to open each channel individually (LOCI 'Split channels'), and uses the ImageJ 'Image/Color/Merge channels..' command to merge the channels in your selected channel order.  When you say that the macro doesn't give the save result as the Fluoview Viewer, are you setting the channel order correctly?  Lowest channel number is the shortest emission wavelength.  

Regards,
Glen
On Mar 3, 2010, at 1:38 PM, Sam Albers wrote: a

Glen MacDonald
Core for Communication Research
Virginia Merrill Bloedel Hearing Research Center
Box 357923
University of Washington
Seattle, WA 98195-7923  USA
(206) 616-4156
[hidden email]








> Hi Curtis,
>
> Thanks for the response.
>
> Your instructions make perfect sense. However, I am stalled by not actually
> being able to get the LOCI plugin to do what I want. I would like to be able
> to create a TIFF file that is exactly like the one produced when I export a
> file from the Olympus viewer (File -> Export, file type=TIFF, output
> format=RGB(using assigned LUT), and the "Merge Channel(Amount method)" box
> checked).
>
>
> I recorded the following macros in attempt to produce this same TIFF image
> as above using LOCI in Image J. Any thoughts on how I might be able to use
> LOCI to do the same as the Olympus software?
>
> run("Bio-Formats Importer", "open=K:\\Confocal_test\\lectinsytoauto.oib
> autoscale merge_channels display_metadata view=[Standard ImageJ]
> stack_order=Default");
> saveAs("Tiff", "K:\\Confocal_test\\lectinsytoauto.tif");
>
> Thanks in advance.
>
>
> Sam
Reply | Threaded
Open this post in threaded view
|

Re: Batch processing of .oib

mditzel
Dear All,

First I must say that I have been pulling what little hair I have left out trying to do what should be a simple task.

Second, I am a total novice at macros / scripts etc. However, following the thread I have modified the Recurssive TIFF convert file to read OIB files (see below). I had to delete the last line about Garbage as IMAGE J did not like it.

When run, the macro log window proceeds and ends (see below), however I can not find the saved TIFF file in the designated TIFF output folder. There are no error messages. Does anyone have ideas what's wrong.

My hair thanks you in advance,

Mark

// recursiveTiffConvert.txt
2 // Written by Curtis Rueden
3 // Last updated on 2011 Feb 22
4
5 // Recursively converts files to TIFF using Bio-Formats.
6
7 // It was originally written to convert Gatan DM3 files, but you can easily
8 // change the code to work with any or all extensions of your choice.
9
10 // Thanks to Chris Zahm for suggestions and improvements:
11 //   - Save as OME-TIFF using Bio-Formats Exporter, to preserve metadata
12 //   - Run garbage collection after each exported file
13
14 /// ext ; // this variable controls the extension of source files
15
16 requires("1.39u");
17 inDir = getDirectory("Choose Directory Containing " + "OIB" + " Files ");
18 outDir = getDirectory("Choose Directory for TIFF Output ");
19 setBatchMode(true);
20 processFiles(inDir, outDir, "");
21 print("-- Done --");
22
23 function processFiles(inBase, outBase, sub) {
24  flattenFolders = true; // this flag controls output directory structure
25  print("-- Processing folder: " + sub + " --");
26  list = getFileList(inBase + sub);
27  if (!flattenFolders) File.makeDirectory(outBase + sub);
28  for (i=0; i<list.length; i++) {
29    path = sub + list[i];
30    upath = toUpperCase(path);
31    if (endsWith(path, "/")) {
32      // recurse into subdirectories
33      processFiles(inBase, outBase, path);
34    }
35    else if (endsWith(upath, "." + "OIB")) {
36      print("-- Processing file: " + path + " --");
37      run("Bio-Formats Importer", "open='" + inBase + path + "' color_mode=Default view=[Standard ImageJ] stack_order=Default use_virtual_stack");
38      outFile = outBase + path + ".ome.tif";
39      if (flattenFolders) outFile = replace(outFile, "/", "_");
40      run("Bio-Formats Exporter", "save=[" + outFile + "] compression=Uncompressed");
41      close();
42  
43    }
44  }
45 }


LOG:


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
24
25
-- Processing folder:  --
26
27
28
29
30
31
35
36
-- Processing file: Image0023.oib --
37
38
39
40
41
42
43
44
29
30
31
35
36
-- Processing file: Image0025.oib --
37
38
39
40
41
42
43
44
29
30
31
35
36
-- Processing file: Image0028.oib --
37
38
39
40
41
42
43
44
29
30
31
35
36
-- Processing file: Image0030.oib --
37
38
39
40
41
42
43
44
29
30
31
32
33
24
25
-- Processing folder: TIFF Convereted/ --
26
27
28
45
34
35
44
45
21
-- Done --
22
23