Revision history [back]
click to hide/show revision 1
initial version

posted Mar 04 '10 at 07:48

Kirk%20Marat's gravatar image

Kirk Marat
711

That value is used, and is most often used to specify 16 bit ints instead of 32 bit ints. I've never actually encountered a 32 bit float data set, although SpinWorks should handle it. I think I will try generating a floating point data set to see if it works :-) Since digitizers are integer devices, there isn't much point in storing the fids as floats. Except: For a very large number of scans where you may overflow the 32 bit word; Real time digital signal processing may be done in floating point and it may make sense to save the result in floating point. All processing of the data should be done in floating point (typically 64 bit). To decode the status word: if ((bh.status & 0x4) != 0 // most common, 32 bit ints { ..... } else if ((bh.status & 0x8) != 0) // 32 bit float { ..... } etc... Remember that the byte order of the data will be BIG ENDIAN, the byte order of the power PC processor.
click to hide/show revision 2
No.1 Revision

posted Mar 04 '10 at 08:05

Kirk%20Marat's gravatar image

Kirk Marat
711

That value is used, and is most often used to specify 16 bit ints instead of 32 bit ints. I've never actually encountered a 32 bit float data set, although SpinWorks should handle it. I think I will try generating a floating point data set to see if it works :-)

Since digitizers are integer devices, there isn't much point in storing the fids as floats. Except: For a very large number of scans where you may overflow the 32 bit word; Real time digital signal processing may be done in floating point and it may make sense to save the result in floating point. All processing of the data should be done in floating point (typically 64 bit).

To decode the status word:

if ((bh.status & 0x4) != 0 // most common, 32 bit ints

{ ..... }

else if ((bh.status & 0x8) != 0) // 32 bit float

{ ..... }

etc...

In a modern language (C#, probably Java and others) you could try something like:

  • read the data point into a 4 element byte array "b"
  • do something like:

try { temp = BitConverter.ToSingle(b, 0); }

catch (Exception){ // exception has been thrown, must not be 32 bit float (Single) }

  • Remember that the byte order of the data will be BIG ENDIAN, the byte order of the power PC processor.

click to hide/show revision 3
No.2 Revision

posted Mar 04 '10 at 09:07

Kirk%20Marat's gravatar image

Kirk Marat
711

That value is used, and is most often used to specify 16 bit ints instead of 32 bit ints. I've never actually encountered a 32 bit float data set, although SpinWorks should handle it. I think I will try generating a floating point data set to see if it works :-)

Since digitizers are integer devices, there isn't much point in storing the fids as floats. Except: For a very large number of scans where you may overflow the 32 bit word; Real time digital signal processing may be done in floating point and it may make sense to save the result in floating point. All processing of the data should be done in floating point (typically 64 bit).

To decode the status word:

if ((bh.status & 0x4) != 0 // most common, 32 bit ints

{ ..... }

else if ((bh.status & 0x8) != 0) // 32 bit float

{ ..... }

etc...

In a modern language (C#, probably Java and others) you could try something like:

byte[] b = new byte[4];

  • read the data point into a the 4 element byte array "b"
  • do something like:

double fp_number;

try { temp fp_number = BitConverter.ToSingle(b, 0); }

catch (Exception){ // exception has been thrown, must not be 32 bit float (Single) }

  • Remember that the byte order of the Varian data will be BIG ENDIAN, the byte order of the power PC processor.
click to hide/show revision 4
formatted code snippets

posted Mar 04 '10 at 10:30

Evgeny%20Fadeev's gravatar image

Evgeny Fadeev
5771

That value is used, and is most often used to specify 16 bit ints instead of 32 bit ints. I've never actually encountered a 32 bit float data set, although SpinWorks should handle it. I think I will try generating a floating point data set to see if it works :-)

Since digitizers are integer devices, there isn't much point in storing the fids as floats. Except: For a very large number of scans where you may overflow the 32 bit word; Real time digital signal processing may be done in floating point and it may make sense to save the result in floating point. All processing of the data should be done in floating point (typically 64 bit).

To decode the status word:

if ((bh.status & 0x4) != 0            // most common, 32 bit ints

ints { ..... }

} else if ((bh.status & 0x8) != 0) // 32 bit float

{ ..... }

etc...

} etc...

In a modern language (C#, probably Java and others) you could try something like:

byte[] b = new byte[4];  

byte[4];
  • read the data point into a the 4 element byte array "b"
  • do something like:

double fp_number;

fpnumber; try { fp_number fpnumber = BitConverter.ToSingle(b, 0); }

catch 0); } catch (Exception){ // exception has been thrown, must not be 32 bit float (Single) (Single) }

  • Remember that the byte order of Varian data will be BIG ENDIAN, the byte order of the power PC processor.
click to hide/show revision 5
No.4 Revision

posted Mar 04 '10 at 11:44

Kirk%20Marat's gravatar image

Kirk Marat
711

That value is used, and is most often used to specify 16 bit ints instead of 32 bit ints. I've never actually encountered a 32 bit float data set, although SpinWorks should handle it. I think I will try generating a floating point data set to see if it works :-)

Since digitizers are integer devices, there isn't much point in storing the fids as floats. Except: For a very large number of scans where you may overflow the 32 bit word; Real time digital signal processing may be done in floating point and it may make sense to save the result in floating point. All processing of the data should be done in floating point (typically 64 bit).

To decode the status word:

if ((bh.status & 0x8) != 0)    // 32 bit float  
{
.....
}

else if ((bh.status & 0x4) != 0            // most common, 32 bit ints
{
 .....
}
 
else if ((bh.status & 0x8) != 0)  0x4) == 0     // 32 bit float  
16 bit ints
{
 .....
}


etc...

You should probably check for float first because Varian states that the 16/32 bit bit (S32) is ignored if the float bit is set.

In a modern language (C#, probably Java and others) you could try something like:

byte[] b = new byte[4];
  • read the data point into a the 4 element byte array "b"
  • do something like:

double fpnumber; try { fpnumber = BitConverter.ToSingle(b, 0); } catch (Exception){ // exception has been thrown, must not be 32 bit float (Single) }

  • Remember that the byte order of Varian data will be BIG ENDIAN, the byte order of the power PC processor.
click to hide/show revision 6
fixed up the markup a bit

posted Mar 04 '10 at 12:13

Evgeny%20Fadeev's gravatar image

Evgeny Fadeev
5771

That value is used, and is most often used to specify 16 bit ints instead of 32 bit ints. I've never actually encountered a 32 bit float data set, although SpinWorks should handle it. I think I will try generating a floating point data set to see if it works :-)

Since digitizers are integer devices, there isn't much point in storing the fids as floats. Except: For a very large number of scans where you may overflow the 32 bit word; Real time digital signal processing may be done in floating point and it may make sense to save the result in floating point. All processing of the data should be done in floating point (typically 64 bit).

To decode the status word:

if ((bh.status & 0x8) != 0)    // 32 bit float  
{
.....
}

else if ((bh.status & 0x4) != 0     // most common, 32 bit ints
{
 .....
}

else if ((bh.status & 0x4) == 0     // 16 bit ints
{
 .....
}


etc...

You should probably check for float first because Varian states that the 16/32 bit bit (S32) is ignored if the float bit is set.

In a modern language (C#, probably Java and others) you could try something like:

byte[] b = new byte[4];
  • read the data point into a the 4 element byte array "b"
  • do something like:

double fpnumber; try { fpnumber = BitConverter.ToSingle(b, 0); } catch catch (Exception){ // exception has been thrown, must not be 32 bit float (Single) }

  • Remember that the byte order of Varian data will be BIG ENDIAN, the byte order of the power PC processor.

powered by CNPROG