How to use the dcmjs.adapters function in dcmjs

To help you get started, we’ve selected a few dcmjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OHIF / Viewers / platform / core / src / DICOMSR / parseDicomStructuredReport.js View on Github external
const parseDicomStructuredReport = (part10SRArrayBuffer, displaySets) => {
  // Get the dicom data as an Object
  const dicomData = dcmjs.data.DicomMessage.readFile(part10SRArrayBuffer);
  const dataset = dcmjs.data.DicomMetaDictionary.naturalizeDataset(
    dicomData.dict
  );

  const { MeasurementReport } = dcmjs.adapters.Cornerstone;
  const storedMeasurementByToolType = MeasurementReport.generateToolState(
    dataset
  );
  const measurementData = {};
  let measurementNumber = 0;

  Object.keys(storedMeasurementByToolType).forEach(toolName => {
    const measurements = storedMeasurementByToolType[toolName];
    measurementData[toolName] = [];

    measurements.forEach(measurement => {
      const instanceMetadata = findInstanceMetadataBySopInstanceUid(
        displaySets,
        measurement.sopInstanceUid
      );
      const { _study: study, _series: series } = instanceMetadata;
github OHIF / Viewers / extensions / vtk / src / handleSegmentationStorage.js View on Github external
const SeriesInstanceUID = displaySet.images[0].getSeriesInstanceUID();
  const SOPInstanceUID = displaySet.images[0].getSOPInstanceUID();

  const arrayBuffer = await retrieveDicomData(
    StudyInstanceUID,
    SeriesInstanceUID,
    SOPInstanceUID,
    wadoRoot
  );

  const dicomData = dcmjs.data.DicomMessage.readFile(arrayBuffer);
  const dataset = dcmjs.data.DicomMetaDictionary.naturalizeDataset(
    dicomData.dict
  );

  const segments = dcmjs.adapters.VTKjs.Segmentation.generateSegments(dataset);

  dataset._meta = dcmjs.data.DicomMetaDictionary.namifyDataset(dicomData.meta);

  const seriesInstanceUid = dataset.ReferencedSeriesSequence.SeriesInstanceUID;
  const displaySets = getDisplaySetsBySeries(
    studies,
    studyInstanceUid,
    seriesInstanceUid
  );

  if (displaySets.length > 1) {
    console.warn(
      "More than one display set with the same seriesInstanceUid. This is not supported yet..."
    );
  }
github OHIF / Viewers / extensions / cornerstone / src / handleSegmentationStorage.js View on Github external
function parseSeg(arrayBuffer, imageIds) {
  return dcmjs.adapters.Cornerstone.Segmentation.generateToolState(
    imageIds,
    arrayBuffer,
    cornerstone.metaData
  );
}
github OHIF / Viewers / platform / core / src / DICOMSR / utils / isToolSupported.js View on Github external
const isToolSupported = toolName => {
  const adapter = dcmjs.adapters.Cornerstone;
  return !!adapter[toolName];
};
github OHIF / Viewers / platform / viewer / src / lib / DICOMSR / parseMeasurementsData.js View on Github external
const parseMeasurementsData = measurementsData => {
  const { MeasurementReport } = dcmjs.adapters.Cornerstone;
  const { getImageIdForImagePath } = measurements;

  const toolState = {};
  const unsupportedTools = [];

  Object.keys(measurementsData).forEach(measurementType => {
    const annotations = measurementsData[measurementType];

    annotations.forEach(annotation => {
      const { toolType, imagePath } = annotation;

      if (isToolSupported(toolType)) {
        const imageId = getImageIdForImagePath(imagePath);
        toolState[imageId] = toolState[imageId] || {};
        toolState[imageId][toolType] = toolState[imageId][toolType] || {
          data: [],

dcmjs

Javascript implementation of DICOM manipulation

MIT
Latest version published 23 days ago

Package Health Score

84 / 100
Full package analysis

Popular dcmjs functions