Skip to content

Add support for 64bit Float #23

Description

@Samreay

At the moment, all 64bit floating point data gets converted to 32bit. The Image.prototype._getFrame function should have the bitpix<0 if condition updated to differentiate between values of -64 and -32.

Specifically, modifying image.coffee such that from line 88 the code reads:

      arr = new Uint32Array(buffer)

      swapEndian = (value) ->
        return ((value & 0xFF) << 24) | ((value & 0xFF00) << 8) | ((value >> 8) & 0xFF00) | ((value >> 24) & 0xFF)

      while i--
        value = arr[i]
        arr[i] = swapEndian(value)

      if bitpix == -64
        i = arr.length
        while i-=2
          tmp = arr[i]
          arr[i] = arr[i + 1]
          arr[i + 1] = tmp
        arr = new Float64Array(buffer)
      else       
        # Initialize a Float32 array using the same buffer
        arr = new Float32Array(buffer)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions