Extracting one particular slice from 3D tiff stack

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

Extracting one particular slice from 3D tiff stack

Andy732
Does anyone know how I might go about opening a 3D tiff stack as a single
tiff with the IMAGEJ library?  The easiest way, which doesn't seem to exist,
would be something like an overloaded openImage() method:

image_plus = new Opener().openImage(tiff_file_name, slice_number);

There, I'm passing in a 3D tiff stack and the particular slice I want, and
then receiving that slice as a (single layer) tiff in return.  

Is there any way to avoid parsing the binary file to extract the slice I
want?  The key is to avoid reading the entire stack from disk every time I
only want a single slice out of the stack.  It's not essential that IMAGEJ
be used for this purpose, but it seems like the best candidate library.
Well, thanks for any help!

Andy
Reply | Threaded
Open this post in threaded view
|

Re: Extracting one particular slice from 3D tiff stack

Gabriel Landini
On Saturday 09 January 2010 20:41:26 you wrote:
> Does anyone know how I might go about opening a 3D tiff stack as a single
> tiff with the IMAGEJ library?  

Do you mean something like this macro?:
run("TIFF Virtual Stack...", "open=/home/gabriel/ImageJ/mri-stack.tif");
setSlice(10);

That would show only 2 slices, the first one at importing time and the one you
specify next, but I do not know if that is what you want.
Cheers
G.
Reply | Threaded
Open this post in threaded view
|

Re: Extracting one particular slice from 3D tiff stack

Andy732
So a virtual stack is just a stack that's too big to read from disk into RAM?  That might be close to what I want, if it's the case that the only slices that are actually read from disk are the first one and the one I specify.  It's kind of annoying because this sort of thing is one of the most basic image manipulation commands in Matlab:

single_layer_tiff = imread(stack_filename, slice_number)

I was hoping there was a similar thing in ImageJ, preferably a simple library function.  Thanks for your help and for any more insight you can give, I appreciate it!


--- On Sat, 1/9/10, Gabriel Landini <[hidden email]> wrote:

From: Gabriel Landini <[hidden email]>
Subject: Re: Extracting one particular slice from 3D tiff stack
To: [hidden email]
Date: Saturday, January 9, 2010, 1:58 PM

On Saturday 09 January 2010 20:41:26 you wrote:
> Does anyone know how I might go about opening a 3D tiff stack as a single
> tiff with the IMAGEJ library? 

Do you mean something like this macro?:
run("TIFF Virtual Stack...", "open=/home/gabriel/ImageJ/mri-stack.tif");
setSlice(10);

That would show only 2 slices, the first one at importing time and the one you
specify next, but I do not know if that is what you want.
Cheers
G.




Reply | Threaded
Open this post in threaded view
|

Re: Extracting one particular slice from 3D tiff stack

Wayne Rasband
On Jan 10, 2010, at 2:50 PM, Andrew Yancy <[hidden email]> wrote:

> So a virtual stack is just a stack that's too big to read from disk  
> into RAM?  That might be close to what I want, if it's the case that  
> the only slices that are actually read from disk are the first one  
> and the one I specify.  It's kind of annoying because this sort of  
> thing is one of the most basic image manipulation commands in Matlab:
>
> single_layer_tiff = imread(stack_filename, slice_number)
>
> I was hoping there was a similar thing in ImageJ, preferably a  
> simple library function.  Thanks for your help and for any more  
> insight you can give, I appreciate it!

The ImageJ 1.43o daily build has a new open(path,n) macro function  
that opens the nth image in a tiff stack. In a plugin, use

    ImagePlus imp = IJ.open(path,n);

-wayne

>
Reply | Threaded
Open this post in threaded view
|

Re: Extracting one particular slice from 3D tiff stack

Bill Christens-Barry
In reply to this post by Andy732
In the same vein, it would be great to be able to utilize a stack slice in the Image Calculator.
Currently, I duplicate the single slice I want to operate on.

Bill
Reply | Threaded
Open this post in threaded view
|

Re: Extracting one particular slice from 3D tiff stack

Antoinette
If we implement a tiff pages extractor within our windows systems, we may extract and export single or multiple pages slices from the TIFF document file. Try my sample apis developed within visual basic.net. Hope they can be helpful.

Private Sub GetOnePageDocument(sourceFilePath As [String], index As Integer, destnStream As Stream) Implements TIFFDocument.GetOnePageDocument
End Sub
Private Sub GetOnePageDocument(sourceFilePath As [String], index As Integer, destnFilePath As [String]) Implements TIFFDocument.GetOnePageDocument
End Sub