How do I get an Image stack?

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

How do I get an Image stack?

Ilan
To my utter surprise and delight, I managed to use ImageJ inside my application and it worked!
Not that I doubt ImageJ, only my ability to use it was in strong doubt.

What I did was use ij.io.Opener.open(fileName). I have a whole list of files and I gave it the first file on the list.
To my delight, up came a window with my file.
Since this works, I need to know how I can create a stack in this window and push in all the files.

Any suggestions as where to start would be greatly appreciated.

Ilan
Reply | Threaded
Open this post in threaded view
|

Re: How do I get an Image stack?

Ben.BigHair
Ilan wrote:

> To my utter surprise and delight, I managed to use ImageJ inside my
> application and it worked!
> Not that I doubt ImageJ, only my ability to use it was in strong doubt.
>
> What I did was use ij.io.Opener.open(fileName). I have a whole list of files
> and I gave it the first file on the list.
> To my delight, up came a window with my file.
> Since this works, I need to know how I can create a stack in this window and
> push in all the files.
>
> Any suggestions as where to start would be greatly appreciated.
>

Hello,

Here's a snippet from some "dusty" code that works for me...

//BEGIN
// list is the string array of filenames
Opener opener = new Opener();
ImagePlus[] imp = new ImagePlus[list.length];
ImageStack stack = new ImageStack(width, height);

try {
         for(int i = 0; i < list.length ; i++){
             imp[i] =opener.openImage(directory, list[i]);
             stack.addSlice(list[i], imp[i].getProcessor());
         }//i loop adding each image to the stack
     } catch (OutOfMemoryError e) {
         IJ.outOfMemory("Opening stack used too much memory");
     }//end of try catch
//END


Ben
Reply | Threaded
Open this post in threaded view
|

Re: How do I get an Image stack?

Ilan
I would just like to express my gratitude to Ben Tupper for helping me solve this problem.
Finally my application makes a new instance of ImageJ and shows my stack of images.

Ilan