Import Raw Automation

I’m trying to automate an image processing procedure with a plugin.

This first step in this process is to use the import raw feature which I can call from my code. What I was wondering is if there is a way to send the values I want to use for the import along with the file and bypass the import raw dialogue box?

Hi @Ben,

You can use the Macro recorder to get what you need. E.g. it gave me the following beanshell code to open the mri sample image (that I resaved as raw) .

fi = new FileInfo();
fi.fileType = FileInfo.GRAY16_UNSIGNED;
fi.width = 186;
fi.height = 226;
fi.nImages = 27;
imp ="<directory>/mri-stack.raw", fi);


1 Like

Thanks, bogovicj this was a huge help.

1 Like

Btw, if you’re not using it as a macro, but part of a bigger code base, it’s often helpful to be able to track down the source code ( so you can get your imports correct).

Fiji dev’s have made this alot easier lately:
if you type Raw in the Fiji search bar (bottom right of the main window), a window shows up with some ideas about what plugin, function you mean.

  • I picked Raw... since that’s the importer
  • Then i click the Source button in the window (bottom right of the “Quick Search” window)

That opens this github page. Which shows me that ij.plugin.Raw has the code that’s being called by the macro that the recorder generates.