Open images in FIJI using jython script

Hello,

apologies if my question is dumb, but i’m new to imageJ/FIJI and python.

I’m trying to open .vsi images (olympus) using bioformats, save the slices in the stack individually and then close the windows. In the imageJ macro language this is written as:

  // Open image using bioformats	
  options = "open=" + dir + file + " color_mode=Default rois_import=[ROI manager] view=[Data Browser] stack_order=XYCZT use_virtual_stack series_1";
  run("Bio-Formats", options);

  // Blow up stack and save individual images    
  run("Stack to Images");

  ids=newArray(nImages); 
  for (i=0;i<nImages;i++) { 
      selectImage(i+1); 
      saveAs("tiff", posfolder + "im_" + i+1);
  }
  macro "Close All Windows" { 
      while (nImages>0) { 
          selectImage(nImages); 
          close(); 
      } 
  } 

Could someone tell me how to write this in jython?

Thank you!

Examples how to use bio-formats from scripting languages can be found on the Scripting Toolbox page:

where also the following example script by @ctrueden is linked:

Hope that helps to get you started :slight_smile:

3 Likes

That’s great! Thank you!