GithubHelp home page GithubHelp logo

daikon's Introduction

Daikon

Daikon is a pure JavaScript DICOM reader. Here are some of its features:

  • Works in the browser and Node.js environments.
  • Parses DICOM headers and reads image data.
  • Supports compressed DICOM data.
  • Orders and concatenates multi-file image data.
  • Supports RGB and Palette data.
  • Supports Siemens "Mosaic" image data.
  • Parses Siemens CSA header.

Supported Transfer Syntax

Uncompressed:

  • 1.2.840.10008.1.2 (Implicit VR Little Endian)
  • 1.2.840.10008.1.2.1 (Explicit VR Little Endian)
  • 1.2.840.10008.1.2.2 (Explicit VR Big Endian)

Compressed:

  • 1.2.840.10008.1.2.1.99 (Deflated Explicit VR Little Endian)
  • 1.2.840.10008.1.2.4.50 (JPEG Baseline (Process 1) Lossy JPEG 8-bit)
  • 1.2.840.10008.1.2.4.51 (JPEG Baseline (Processes 2 & 4) Lossy JPEG 12-bit)
  • 1.2.840.10008.1.2.4.57 (JPEG Lossless, Nonhierarchical (Processes 14))
  • 1.2.840.10008.1.2.4.70 (JPEG Lossless, Nonhierarchical (Processes 14 [Selection 1]))
  • 1.2.840.10008.1.2.4.80 (JPEG-LS Image Compression (Lossless Only))
  • 1.2.840.10008.1.2.4.81 (JPEG-LS Image Compression)
  • 1.2.840.10008.1.2.4.90 (JPEG 2000 Image Compression (Lossless Only))
  • 1.2.840.10008.1.2.4.91 (JPEG 2000 Image Compression)
  • 1.2.840.10008.1.2.5 (RLE Lossless)

Usage

API and more examples

Simple Example

daikon.Parser.verbose = true;
var image = daikon.Series.parseImage(data);
var rawData = image.getRawData();  // ArrayBuffer
var interpretedData = image.getInterpretedData();  // Float32Array (handles byte order, datatype, scale, mask)
//var interpretedData = image.getInterpretedData(true);  // Array
//var interpretedData = image.getInterpretedData(false, true);  // Object with properties: data, min, max, minIndex, maxIndex, numCols, numRows

Series Example

var series = new daikon.Series();
var files = fs.readdirSync('./data/volume/');

// iterate over files
for (var ctr in files) {
    var name = './data/volume/' + files[ctr];
    var buf = fs.readFileSync(name);
    
    // parse DICOM file
    var image = daikon.Series.parseImage(new DataView(toArrayBuffer(buf)));

    if (image === null) {
        console.error(daikon.Series.parserError);
    } else if (image.hasPixelData()) {
        // if it's part of the same series, add it
        if ((series.images.length === 0) || 
                (image.getSeriesId() === series.images[0].getSeriesId())) {
            series.addImage(image);
        }
    }
}

// order the image files, determines number of frames, etc.
series.buildSeries();

// output some header info
console.log("Number of images read is " + series.images.length);
console.log("Each slice is " + series.images[0].getCols() + " x " + series.images[0].getRows());
console.log("Each voxel is " + series.images[0].getBitsAllocated() + " bits, " + 
    (series.images[0].littleEndian ? "little" : "big") + " endian");

// concat the image data into a single ArrayBuffer
series.concatenateImageData(null, function (imageData) {
    console.log("Total image data size is " + imageData.byteLength + " bytes");
});

Browser

See tests/browser.html for an example. For a more advanced example, see this class in Papaya.

Install

Get a packaged source file from the release folder:

Or install via NPM:

npm install daikon

Testing

npm test

Building

npm run build

This will output daikon.js and daikon-min.js to build/

Acknowledgments

Daikon makes use of JPEGLosslessDecoderJS for JPEG Lossless support as well as the following third-party libraries:

Also thanks to these contributors:

Disclaimer

The authors of this software have not sought nor received approval for clinical/diagnostic use of this software library.

daikon's People

Contributors

cdrake avatar hanayik avatar jens-ox avatar manusangar avatar martinezmj-ims avatar neurolabusc avatar nickhingston avatar parneshraniga avatar rii-mango avatar syzer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

daikon's Issues

Console log spam from Siemens header

daikon.Siemens.readHeader() is generating error messages like this:

RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at b.Siemens.readHeader (scripts.bundle.js:761)
    at Function.b.Tag.convertPrivateValue (scripts.bundle.js:777)
    at new b.Tag (scripts.bundle.js:765)
    at b.Parser.getNextTag (scripts.bundle.js:738)
    at b.Parser.parse (scripts.bundle.js:735)
    at Function.b.Series.parseImage (scripts.bundle.js:748)
    at papaya.volume.dicom.HeaderDICOM.readNextHeaderData (scripts.bundle.js:1350)
    at papaya.volume.dicom.HeaderDICOM.<anonymous> (scripts.bundle.js:1350)

This occurs when this.data is less than 4 bytes long (and so presumably is not a CSA2 header).

Cannot extract single frames without allocating memory for all

Many files have multiple image frames, but getInterpolatedData() does not have an option to extract only a single frame in this situation. It can be done by the calling code, but a large amount of memory must be allocated to interpret all of the data.

As a first step to resolve, getInterpolatedData() can be updated to only process the frame of interest. I did this in PR #12

Next step would be to extend this to only decompress the frame of interest as well, but this is a start.

Opening a Zipped DICOM File

I was wondering if Diakon can also read a zipped DICOM directory... I'm starting to store my DICOM data as a single ZIP file whenever I can...

I've used JSZIP in the past to open a zip file and then access individual files; just wanted to see if there's already a mechanism with Daikon that supports this before I try hacking the two together..

can't build app in docker

Hi,

Everything works fine on my local repo but when I create container with docker-compose I end up with:

npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://github.com/rii-mango/JPEGLosslessDecoderJS.git
npm ERR! enoent 
npm ERR! enoent 
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

In docker I don't use git and daikon in package-lock.json looks like that:

    "daikon": {
      "version": "1.2.42",
      "resolved": "https://registry.npmjs.org/daikon/-/daikon-1.2.42.tgz",
      "integrity": "sha512-uEJKRNpJo6lWCMr1UehBJLCnpsmoY4cmaedjL03UCeUmyoV2SsCYiEo8I+rhfuoj2FHqtDJFRGfZAW729berww==",
      "requires": {
        "jpeg-lossless-decoder-js": "git+https://github.com/rii-mango/JPEGLosslessDecoderJS.git",
        "pako": "^1.0.6"
      },
      "dependencies": {
        "jpeg-lossless-decoder-js": {
          "version": "git+https://github.com/rii-mango/JPEGLosslessDecoderJS.git#78fe90c7cae985b1a394a66f99c81633144bb867",
          "from": "git+https://github.com/rii-mango/JPEGLosslessDecoderJS.git"
        }
      }
    },

I guess all references to git should be replaced with general ones like for pako

Need to bump version and provide a new release

@rii-mango , some Github actions tests and updated dependencies maintenance tasks were done by @jens-ox. We need to build and publish a new release to NPM. However, I noticed there is now an esbuild and a build script. Which are you calling prior to publishing? I think we should also update the README.md to reflect the order of operations for publishing a new release.

Transfer Syntax Change

Hello!

I need to convert a dicom file from a given Transfer Syntax to another. I couldn't find any save functions. Could you explain me how to do that?

Thanks.

how to get byte value of a tag and some understanding at first glance

first, thank you for this nice program.
for some reason(chinese chart garbled or others). I want to get the byte value(hex or base64 or other types) of an value. Can I just transform the garbled string to byte to get what I want? I can use offset to safely get if, but I definitely not the efficient way.
I can get image bitmap by getInterpretedData() ? The bitmap haven't been transform by windows width and center? Is there function to apply windows width and center or function build in Papaya(nice name,so cute, or it means something, appearance similar to mango:) ), did function use table lookup to finish it? Is table looking up really faster than calculating? May be there Inflection point for the efficiency. haha. so many question, just for discussion.thank you again.

All tag value is "null"

image
Hello! i did console.log(daikon.Image)๏ผŒbut i saw all value is "null", and functions like getCols() getRows() getSliceGap()..... get "null", too. Is it due to "private data"? The .dcm has been encrypted? But i can see values by "Sante DICOM Viewer".
Thanks in advance.
image

getTag can return a date object

const studyDate = image.getTag(0x8, 0x20).value?.[0]; returns a Date instance. This is unexpected behavior and not well documented. It is also problematic because the Date instance returned is keyed to the caller's timezone.

On a side note, I have a daikon.d.ts file that covers Tag and Image. It was auto-generated by ChatGPT and is 826 lines long. I have not thoroughly reviewed it. If you want it I can make a pull request, but this is a, you want it, you merge it type of offer though.

convert series.concatenateImageData() data to interpreted array

I assume that the function series.concatenateImageData gives a single stream of data of all the images as a raw ArrayBuffer.

series.concatenateImageData(null,function(imageData){
  // imageData is a ArrayBuffer{}
});

Is there a way to convert this buffer to sensible data like something similar to the image.getInterpretedData()? Or simple by creating a Float32Array out of it would suffice?

Create NPM package

Daikon is not a proper NPM package (it is missing pacakge.json) so we can not install it as a node package.

nico@vpn-17218216-084:~/work/gitroot/vjs$ npm install git+https://github.com/rii-mango/Daikon.git
npm WARN package.json [email protected] No repository field.
npm ERR! Error: ENOENT, open '/var/folders/g9/pdmxn9d17d50xghb4_yx84hh0005jg/T/npm-16039-Em_eiQXd/1435917850076-0.7271956556942314/package/package.json'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Darwin 14.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "git+https://github.com/rii-mango/Daikon.git"
npm ERR! cwd /Users/nico/work/gitroot/vjs
npm ERR! node -v v0.10.21
npm ERR! npm -v 1.3.11
npm ERR! path /var/folders/g9/pdmxn9d17d50xghb4_yx84hh0005jg/T/npm-16039-Em_eiQXd/1435917850076-0.7271956556942314/package/package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/nico/work/gitroot/vjs/npm-debug.log
npm ERR! not ok code 0

Error while reading dicom file

Hi there,

I was trying to load a dicom file through papaya. But it gave an error saying 'offset is outside the bounds of DataView", at line "Daikon.tag.getFloat64()".

Inside this function, the boundary of the FOR loop, is smaller than '1' (in this case, m=0.5), while the iterator 'u' starts from '0', and increment is '1'. So in this case, the line 'a.getFloat64()' throw an error.

I wonder, isn't it reasonable to do Math.floor() on the 'm' ? Any ideas on this would be appreciated!

image

Thanks,
Kristin

Get Pixel Data as an array and plot it in Plotly

Hi there,

I have a set of Dicom images and I need to plot a Heatmap of a slice using the plotly.js. I am reading the images as given in your driver.js file. But I am not able to understand how I can pass this data as an array to the plotly library. If it was python-pydicom, there is a way to read the image as numpy array and from there, proceed with it, but when it comes to using this, I am stuck at converting the ArrayBuffer to a ndarray or standard array or typed array.

With regards
Sagar DV

Example show a dicom frame in the browser

I am writing a NodeJS application that reads dicom images using your library. Everything works fine and the library is easy to use. Tnx for that! ๐Ÿ‘

I was only wondering if it is also possible with Daikon extract frames and write them to disk as a readable format, like jpeg, png or bmp. I want to use one of these formats to show in the browser within an tag. Your example shows how to extract pixeldata/frames, but I only miss the last step (writing them to disk like jpeg, png or bmp).

Is this possible to do with Daikon or do I need some other libraries for this?

build on windows

cmd line show this:
'rm' is not recognized as an internal or external command
May be we can make build on windows?

More specific documentation for .getInterpretedData()

I'm not sure what encoding format the array is that .getInterpretedData() returns. I'm trying to read a DICOM file and save out a single slice of the 3D volume as a new jpeg, but I'm fairly certain I need some intermediate processing but without a format to start on it's impossible to know what to do! This is my current code:

let daikonImageData = daikonImage.getInterpretedData(false, true);
let rawSlice = daikonImageData.data.slice(0, daikonImageData.numCols * daikonImageData.numRows);
fs.writeFileSync("TestImage.jpeg", jpeg.encode({
    data: rawSlice,
    width: daikonImageData.numCols,
    height: daikonImageData.numRows }));

Thanks for any hints you can give!

Parse issue with null tag values

I have a DCM file with a null value for โ€˜Specific Character Set (0008,0005)' stops parse of rest of the file.

PR coming...

Image in negative

These images are in negative.

Think the relevant tags are:
(0028,0004) Photometric Interpretation [MONOCHROME1]
(0028,1041) Pixel Intensity Relationship Sign [-1]
(2050,0020) PresentationLUT Shape [INVERSE]

I can't seem to find information about what should happen in the case that more than one tag specifies the pixel values are inverse
My thoughts were that it would be an XOR relationship, so one inverse would cancel the other.
But have found some DICOMs that (2050,0020) PresentationLUT Shape [INVERSE] & (0028,0004) Photometric Interpretation [MONOCHROME1] which DO require inverting.

Should it just be, invert if one or more of these tags specify inverse...or?

ISSUE61-56.dcm.zip
ISSUE61-55.dcm.zip

Daikon Example Sereis Error

Hi,
I want to run the example series which put in the readme part of github. But I have a big problem that all [var image = daikon.Series.parseImage(new DataView(buffer));] image value is null.
How can I solve this issue? Please guide me more.
Thanks.

The codes are here ::

`const http = require('http');
const fs = require('fs');
const daikon = require('daikon');

var series = new daikon.Series();
var files = fs.readdirSync('./data/volume/');
console.log(files);

for (var ctr in files) {
    var name = './data/volume/' + files[ctr];
    var buf = fs.readFileSync(name);

    var buffer = new ArrayBuffer(buf);
    console.log(buffer)


    var image = daikon.Series.parseImage(new DataView(buffer));
    console.log(image)
    if (image === null) {
        console.error(daikon.Series.parserError);
    } else if (image.hasPixelData()) {
        // if it's part of the same series, add it
        if ((series.images.length === 0) ||
            (image.getSeriesId() === series.images[0].getSeriesId())) {
            series.addImage(image);
        }
    }
}

series.buildSeries();

console.log("Number of images read is " + series.images.length);
console.log("Each slice is " + series.images[0].getCols() + " x " + series.images[0].getRows());
console.log("Each voxel is " + series.images[0].getBitsAllocated() + " bits, " +
    (series.images[0].littleEndian ? "little" : "big") + " endian");


series.concatenateImageData(null, function (imageData) {
    console.log("Total image data size is " + imageData.byteLength + " bytes");
});



const port = process.env.PORT || 3000;

const server = http.createServer((req, res) => {
    res.statusCode = 200;
    res.end('Hello Node!\n');
});

server.listen(port, () => {
    console.log(`Server running on http://localhost:${port}/`);
});
`

After run the .js file :: npm start
I have got these error:

`behnaz@behnaz-Lenovo:~/Desktop/behnaz/nodejs-hello-world-master$ npm start

> [email protected] start /home/behnaz/Desktop/behnaz/nodejs-hello-world-master
> node index.js

[
  'brain_001.dcm', 'brain_002.dcm',
  'brain_003.dcm', 'brain_004.dcm',
  'brain_005.dcm', 'brain_006.dcm',
  'brain_007.dcm', 'brain_008.dcm',
  'brain_009.dcm', 'brain_010.dcm',
  'brain_011.dcm', 'brain_012.dcm',
  'brain_013.dcm', 'brain_014.dcm',
  'brain_015.dcm', 'brain_016.dcm',
  'brain_017.dcm', 'brain_018.dcm',
  'brain_019.dcm', 'brain_020.dcm'
]
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 }
null
RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at Function.daikon.Parser.isMagicCookieFound (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:83:18)
    at daikon.Parser.findFirstTagOffset (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:381:23)
    at daikon.Parser.parse (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/parser.js:104:23)
    at Function.daikon.Series.parseImage (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:68:20)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:17:31)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:372
    this.isMosaic = this.images[0].isMosaic();
                                   ^

TypeError: Cannot read property 'isMosaic' of undefined
    at daikon.Series.buildSeries (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/node_modules/daikon/src/series.js:372:36)
    at Object.<anonymous> (/home/behnaz/Desktop/behnaz/nodejs-hello-world-master/index.js:31:8)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/behnaz/.npm/_logs/2020-04-27T15_03_02_713Z-debug.log
`

Cant open encapsulated PDF.

getEncapsulatedData() function is looking for pixel data. But in my case, dicom file doesnt have pixel data. And i think daikon doesnt read Encapsulated Document tag. How can I open or read this pdf data with daikon.js

`Image.getInterpolatedData()` returns blank image data

When processing images where the getDataType() method returns values other than daikon.Image.BYTE_TYPE_INTEGER and daikon.Image.BYTE_TYPE_INTEGER_UNSIGNED, the getInterpolatedData() method returns all-zero data, due to this block of code in the pixel-processing loop:

    for (ctr = 0; ctr < numElements; ctr += 1) {
// Value only assigned if datatype has one of two values, but it often has others
        if (datatype === daikon.Image.BYTE_TYPE_INTEGER) {
            if (numBytes === 1) {
                rawValue = dataView.getInt8(ctr * numBytes);
            } else if (numBytes === 2) {
                rawValue = dataView.getInt16(ctr * numBytes, littleEndian);
            }
        } else if (datatype === daikon.Image.BYTE_TYPE_INTEGER_UNSIGNED) {
            if (numBytes === 1) {
                rawValue = dataView.getUint8(ctr * numBytes);
            } else if (numBytes === 2) {
                rawValue = dataView.getUint16(ctr * numBytes, littleEndian);
            }
        }
 
// ** At this point, value can be unassigned (==0) if neither of above forks taken
        value = ((rawValue & mask) * slope) + intercept;
        data[ctr] = value;

// ... rest of loop

Solution is to limit datatype to only the standard values - I created PR #13 to address this.

daikon chinese garbled

hi, @martinezmj ,I have some dicom files, some file's patient name is chinese, and daikon.Image.prototype.getPatientName will return garbled. I do not know how to solve this issue.

The attch file is garbled dcm file for test.
Thanks for your help..

Save changes into a Dicom

In my work I need to anonymize dicoms file as we move it through internet and if
been catch must NOT contain certain informations about patient. So I wanna know if this could be done with this amazing tool, Daikon.
Thanks!

Stacks and Frames

Hello, do you plan to add "stacks" and "frames" objects similarly to series and images?

I like very much your approach and was planning on implementing a similar solution using: series > images > stacks > frames.

My gold standard would be the new Enhanced MRI DICOM format

Does it make sense to include the stacks and frames concepts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.