Login  Register

Re: Open Samples question!

Posted by Wayne Rasband on Mar 29, 2007; 5:17pm
URL: http://imagej.273.s1.nabble.com/Open-Samples-question-tp3699932p3699933.html

> Hi all ImageJ users!  Do anyone know if its possible to put your own
> pictures under File>Open Samples? Just to make it easier to find them
> and process them.

There is no easy way to do this but what you can do is add a similar
menu to the tool bar. Adding the following macro code to
ImageJ/macros/StartupMacros.txt adds a menu to the tool bar that lists
the images in the SampleImages directory in your home directory. You
will need to be running ImageJ 1.38b or later.

   var imagesDir = getDirectory("home")+"SampleImages"+File.separator;
   var imageList = getImageList();
   var iCmds = newMenu("Images Menu Tool", imageList);

   macro "Images Menu Tool - C037T0b11IT4b09mTcb09g" {
        open(imagesDir +getArgument());
   }

   function getImageList() {
       list = newArray("'<home-dir>/SampleImages' directory not found");
       if (!File.exists(imagesDir))
            return list;
      else
          return  getFileList(imagesDir);
   }

-wayne