npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gdcm-js

v0.0.4

Published

GDCM from Malaterre ported to js

Downloads

4

Readme

GDCM

NPM

This is the GDCM Library ported to JavaScript using Emscripten. It is useful to convert DICOMs between formats inside browser, ionic, hybrid apps, node... I personally created this to convert and decompress some exotic DICOM types.

Building

In order to build it, just run the buildLinuxMac.sh or buildwin.bat. It generates the javascript version of the malaterre's gdcm built with emscripten then transpiled to JavaScript. For each application it will create two files: gdcmXXX.js and gdcmXXX.mem where is XXX is the original app name.

Using

I created a npm wrapper that

  • Receives the dicom files as Uint8Array through MEMFS and the array of terminal parameters;
  • Returns the MEMFS with converted files as Uint8Array;
  • Stdout and Stderr with console output;

Using GDCM End User Applications

You can use it in same way you you use in the terminal. Please read how to use them here: gdcm referece

Example via node

var fs = require("fs");
var gdcm = require("gdcm-js");
// read dicom bytes
var dicomoriginal = new Uint8Array(fs.readFileSync('data/deflated.dcm')); 
// create a memfs with the file
var memfs = [{name: "input.dcm", data: dicomoriginal}]
// write down the params you have to write into terminal
var args = ["-i", "input.dcm", "-o", "output.dcm", "-w"]
// run the app
var result = gdcm.gdcmconv({MEMFS:memfs,arguments:args});
// get results from result
// output files will be stored into MEMFS variable
console.log("input size: " + dicomoriginal.length + ", output size: " + result.MEMFS[0].data.length);

Using directly from browser

You can load directly the desired application instead of the app from npm version. Just download and serve both files "appname.js" and "appname.mem" and use like this:

For this instance my appname is gdcmconv.

<script src="https://raw.githubusercontent.com/InfiniBrains/gdcm-js/master/gdcmconv.js"></script>

And use it:

var dicomoriginal = new Uint8Array(????); // you must provide this
var memfs = [{name: "input.dcm", data: dicomoriginal}]; 
var args = ["-i", "input.dcm", "-o", "output.dcm", "-w"]; // the very same arguments you should pass via terminal
var result =  gdcmFunc({MEMFS:memfs,arguments:args}); // run the app
console.log(result.MEMFS[0].data); // print the file output contents

ToDo:

If you are planning to use more than one application, all of them will have the functioname gdcmFunc so be careful when importing many apps via browser. Via node this must be fine.

Authors

  • Alexandre Tolstenko
  • Cândido Sales