Save As Raw Data 16-bit as signed shorts

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

Save As Raw Data 16-bit as signed shorts

Simon Roussel
Hi,
Is there any way or workaround to "Save As/Raw Data ..." 16-bit images as
SIGNED shorts (in a macro) ?
Thanks in advance,
Simon
Reply | Threaded
Open this post in threaded view
|

Re: Save As Raw Data 16-bit as signed shorts

Michael Schmid
Hi Simon,

as far as I know. such an option does not exist. There is a
very simple workaround, however:

(1) Make sure that raw pixel value 32768 corresponds to signed
zero (you get it like this when opening signed 16-bit images)

(2) Run Process>Math>XOR with 1000000000000000 binary
(a one with 15 zeros).

(3) Save the file as raw.

Michael
________________________________________________________________

On 4 Feb 2008, at 10:31, Simon Roussel wrote:

> Hi,
> Is there any way or workaround to "Save As/Raw Data ..." 16-bit  
> images as
> SIGNED shorts (in a macro) ?
> Thanks in advance,
> Simon
Reply | Threaded
Open this post in threaded view
|

Re: Save As Raw Data 16-bit as signed shorts

Wayne Rasband
In reply to this post by Simon Roussel
The File>Save As>Raw Data command saves signed 16-bit images (e.g.,
File>Open Samples>CT) as signed shorts. You can convert an unsigned
16-bit image to a signed 16-bit image using

   run("Add...", "value=32768");
   run("Calibrate...", "function=[Straight Line] unit=[Value] text1=[0
32768] text2=[-32768 0]");

Which adds 32768 to the image and creates a calibration function that
subtracts 32768.

-wayne

On Feb 4, 2008, at 4:31 AM, Simon Roussel wrote:

> Hi,
> Is there any way or workaround to "Save As/Raw Data ..." 16-bit images
> as
> SIGNED shorts (in a macro) ?
> Thanks in advance,
> Simon
>
Reply | Threaded
Open this post in threaded view
|

Re: Save As Raw Data 16-bit as signed shorts

Simon Roussel
In reply to this post by Simon Roussel
Thanks a lot, it works perfectly.

To note, however (Other reply from Wayne), "The File>Save As>Raw Data
command saves signed 16-bit images (e.g.,File>Open Samples>CT) as signed
shorts".
This in not in the documentation.

Simon


>Hi Simon,
>
>as far as I know. such an option does not exist. There is a
>very simple workaround, however:
>
>(1) Make sure that raw pixel value 32768 corresponds to signed
>zero (you get it like this when opening signed 16-bit images)
>
>(2) Run Process>Math>XOR with 1000000000000000 binary
>(a one with 15 zeros).
>
>(3) Save the file as raw.
>
>Michael
>________________________________________________________________
>
>On 4 Feb 2008, at 10:31, Simon Roussel wrote:
>
>> Hi,
>> Is there any way or workaround to "Save As/Raw Data ..." 16-bit
>> images as
>> SIGNED shorts (in a macro) ?
>> Thanks in advance,
>> Simon
>=========================================================================
Reply | Threaded
Open this post in threaded view
|

Antwort: Re: Save As Raw Data 16-bit as signed shorts

Joachim Wesner
ImageJ Interest Group <[hidden email]> schrieb am 04.02.2008 17:40:08:

> Thanks a lot, it works perfectly.
>
> To note, however (Other reply from Wayne), "The File>Save As>Raw Data
> command saves signed 16-bit images (e.g.,File>Open Samples>CT) as signed
> shorts".
> This in not in the documentation.
>
> Simon

Interesting, but actually what seems to happen is that the "calibration
trick" Wayne mentioned is stored with the data as a
Metatag, so it will behave as "signed" correctly when you open it the next
time, but 0 in the data is actually stored as RAW 32768,
so data in a .TIF-file will appear different when you open it with any
other (non calibration-tag-aware) software!
(Would need to flip the sign-bit again)!?

Correct me if I´m wrong!

Joachim


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________