Login  Register

Re: text file as stack

Posted by dscho on Jan 31, 2006; 12:59pm
URL: http://imagej.273.s1.nabble.com/text-file-as-stack-tp3703893p3703895.html

Hi,

On Tue, 31 Jan 2006, Wang, Junsheng wrote:

> I'd like to get this kind of plugin as well. Can you show me a example
> to add the header to the image stack?

I just got an example file, which starts like this:

-- snip --
ascii
3 uc
100 100 100
0.0  1000.00  0.0  1000.00  0.0  1000.00
 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
3 3 3 3 3 3
 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
3 3 3 3 3 3
 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
3 3 3 3 3 3
-- snap --

Evidently, "ascii" means that the pixel values are not raw, i.e. they are
written out as numbers.

"3 uc" probably means that it is 3-dimensional, and the values are
unsigned chars (0-255).

"100 100 100" probably means that the pixel dimension is 100x100x100, and

"0.0 1000.0 0.0 1000.0 0.0 1000.0" probably is the bounding box, i.e. the
real dimension.

I whipped up a small plugin to read that data, which is attached.

Note that I use StreamTokenizer, which does not care at all about line
breaks, but handles all white spaces (including line breaks) alike.

Note further that I only implemented an "UnsignedCharReader", as I am not
sure if anything else is needed at all.

Hth,
Dscho

RawAsciiReader_.java (4K) Download Attachment