help with opening fcimg 12 bit image

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

help with opening fcimg 12 bit image

Bruno Jesus-6
Hello,

Can anyone help me with importing this image type?  can be downloaded here:
www.aikido-gdine.org/test.fcimg

Accordingly to the manufacturer it's a 12 bit image 512 x 512 px that could
be used with ImageJ. They also provide the following information:

First 16 bytes contains information about image
Width                           4 byte (int)
Height                  4 byte (int)
Bits per pixel          4 byte (int)
Bytes per pixel         4 byte (int)

Data                            Width * Height * BytesPerPixel

I've tried all the import Raw options and none seems to work. I'm guessing
that it's because there's no 12 bit option? The 16 bit option opens the
image but it doesn't look like the original image, it's distorted.

Is there anyway I can open this image with ImageJ?

Many thanks in advance,
Bruno
Reply | Threaded
Open this post in threaded view
|

Re: help with opening fcimg 12 bit image

Michael Schmid
Hi Bruno,

your sample image is 512*256 in size, and you can open it with

run("Raw...", "open=["+path+"] image=[16-bit Unsigned] width=512 height=256 offset=16 number=1 gap=0 little-endian");

The header (initial 16 bytes) contain little-endian short integers (2 bytes each):
512 //width
0
256 //height
0
12  //bits/pixel of the original data
0
2   //bytes/pixel, thus you can read it as 16-bit integers
0  


Michael
________________________________________________________________
On Apr 10, 2012, at 15:04, Bruno Jesus wrote:

> Hello,
>
> Can anyone help me with importing this image type?  can be downloaded here:
> www.aikido-gdine.org/test.fcimg
>
> Accordingly to the manufacturer it's a 12 bit image 512 x 512 px that could
> be used with ImageJ. They also provide the following information:
>
> First 16 bytes contains information about image
> Width                           4 byte (int)
> Height                  4 byte (int)
> Bits per pixel          4 byte (int)
> Bytes per pixel         4 byte (int)
>
> Data                            Width * Height * BytesPerPixel
>
> I've tried all the import Raw options and none seems to work. I'm guessing
> that it's because there's no 12 bit option? The 16 bit option opens the
> image but it doesn't look like the original image, it's distorted.
>
> Is there anyway I can open this image with ImageJ?
>
> Many thanks in advance,
> Bruno
Reply | Threaded
Open this post in threaded view
|

Re: help with opening fcimg 12 bit image

Bruno Jesus-6
In reply to this post by Bruno Jesus-6
Hi Michael,

Thanks for the quick reply! It works exactly as you say. I have no idea why the image looks distorted but it has to be something related to the camera that produced the image rather then the importation in ImageJ.

Can you explain me how you had access to the information that told you the image dimensions? Did you use ImageJ for that also?

Thanks for all the help,
Bruno
Reply | Threaded
Open this post in threaded view
|

Re: help with opening fcimg 12 bit image

Jerome Mutterer-3
Hi,
The 4-bytes values from your files can be read with a simple macro:

path = File.openDialog("Choose file to open");
s=File.openAsRawString(path, 20); // get the 20 first raw bytes
width=read32bitValueAt(s,0); // bytes 0-3
height=read32bitValueAt(s,4); // bytes 4-7

run("Raw...", "open=["+path+"] image=[16-bit Unsigned] width=&width
height=&height offset=16 number=1 gap=0 little-endian");

function read32bitValueAt(f,i) {
  result = charCodeAt(f, i+3)<<24;
  result += charCodeAt(f, i+2)<<16;
  result += charCodeAt(f, i+1)<<8;
  result += charCodeAt(f, i);
  return result;
}
// end

On 11 April 2012 09:10, Bruno Jesus <[hidden email]> wrote:
>
> Hi Michael,
>
> Thanks for the quick reply! It works exactly as you say. I have no idea
why the image looks distorted but it has to be something related to the
camera that produced the image rather then the importation in ImageJ.
>
> Can you explain me how you had access to the information that told you
the image dimensions? Did you use ImageJ for that also?
>
> Thanks for all the help,
> Bruno
Reply | Threaded
Open this post in threaded view
|

Re: help with opening fcimg 12 bit image

Michael Schmid
In reply to this post by Bruno Jesus-6
Hi Bruno,

apart from opening the file as String, as mentioned by Jerome Mutterer, there is another possibility to read the header in the macro:
(mind possible line breaks introduced by the mailer):

path = File.openDialog("Choose file to open");
run("Raw...", "open=["+path+"] image=[16-bit Unsigned] width=8 height=1 offset=0 number=1 gap=0 little-endian");
width = getPixel(0,0);
height = getPixel(2,0);
// bits/pixel and bytes/pixel might be read as getPixel(4,0), getPixel(6,0) if desired
close();
run("Raw...", "open=["+path+"] image=[16-bit Unsigned] width=&width height=&height offset=16 number=1 gap=0 little-endian");


Michael
________________________________________________________________
On Apr 11, 2012, at 09:10, Bruno Jesus wrote:

> Hi Michael,
>
> Thanks for the quick reply! It works exactly as you say. I have no idea why the image looks distorted but it has to be something related to the camera that produced the image rather then the importation in ImageJ.
>
> Can you explain me how you had access to the information that told you the image dimensions? Did you use ImageJ for that also?
>
> Thanks for all the help,
> Bruno