Posted by
Jerome Mutterer-3 on
Apr 17, 2014; 8:54pm
URL: http://imagej.273.s1.nabble.com/Can-one-open-hexadecimal-text-image-tp5007340p5007345.html
Dear Neil,
The following macro reads your hex txt image.
Sincerely,
Jerome
hexImg = File.openAsString("/Users/jerome/Downloads/test 5_0.txt");
lines = split (hexImg,'\n');
height = lines.length;
firstLine = split (lines[0],' ');
width = firstLine.length;
newImage('Hex Image', '8-bit', width, height, 1);
for (y=0;y<height;y++) {
pixels = split (lines[y],' ');
for (x=0;x<pixels.length;x++) {
setPixel (x,y,parseInt(pixels[x],16));
}
}
// end macro
On 17 April 2014 19:42, Neil Fazel <
[hidden email]> wrote:
> I'm trying to read the 8-bit image output file of a CCD. The output is a
> text file, and the values are in hexadecimal format. When I tried File ->
> Import -> Text Image ..., the file was read as a 32-bit image (I was
> expecting 8-bit image). When I saved the image back as a new text image,
> there were NaN values in it (which didn't exist before). It seems the
> import didn't work.
>
> Is there a way to open/import this file? I have attached it.
>
> Thanks,
> Neil
>
>
--
Jerome Mutterer
CNRS - Institut de biologie moléculaire des plantes
12, rue du Général Zimmer
67084 Strasbourg Cedex
T 0367155339
www.ibmp.cnrs.fr
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html