Login  Register

Re: programmatically opening a stack from a list of filenames

Posted by Ben.BigHair on Apr 03, 2007; 8:33pm
URL: http://imagej.273.s1.nabble.com/programmatically-opening-a-stack-from-a-list-of-filenames-tp3699826p3699833.html

Albert Cardona wrote:

> Ben,
>
> Perhaps best is:
>
> public class StackPlus extends ImagePlus {
>     public StackPlus(String concat_filenames) {
>         super();
>         String[] files = concat_filenames.split("\n");
>         // open all files and place their processors in an ImageStack
>         // ...
>     }
> }
>
> Then just call, from your plugin:
>
> public class My_Plugin implements PlugIn {
>     public void run(String arg) {
>         // obtain filenames from wherever
>         // ...
>         ImagePlus imp = new StackPlus(filenames);
>         imp.show();
>     }
> }
>
>
> The above assumed absolute paths where concatenated in a single String and
> separated by newline characters.
>
> Albert

Oh! I didn't understand that it could be this easy. I will try this and,
as you cautioned earlier, make sure that the input image sizes are all
the same.  Pity I can't get to this until next week.  Nuts.

Thanks!
Ben

P.S.  I still have a muddled view of the interrelationships among
ImageStack, ImagePlus and ImageProcessor. I don't have enough experience
  reading UMLs so I can't decipher the UML for ImageJ. But that's
another day.