// Generated file. To retain edits, remove this comment.
import { InterfaceTypes, runPipelineNode } from 'itk-wasm';
import path from 'path';
import { fileURLToPath } from 'url';
/**
 * Read DICOM segmentation object with overlapping segments into a VectorImage.
 *
 * @param {string} dicomFile - Input DICOM file
 * @param {ReadOverlappingSegmentationNodeOptions} options - options object
 *
 * @returns {Promise<ReadOverlappingSegmentationNodeResult>} - result object
 */
async function readOverlappingSegmentationNode(dicomFile, options = {}) {
    const mountDirs = new Set();
    const desiredOutputs = [
        { type: InterfaceTypes.Image },
        { type: InterfaceTypes.JsonCompatible },
    ];
    mountDirs.add(path.dirname(dicomFile));
    const inputs = [];
    const args = [];
    // Inputs
    const dicomFileName = dicomFile;
    args.push(dicomFileName);
    mountDirs.add(path.dirname(dicomFileName));
    // Outputs
    const segImageName = '0';
    args.push(segImageName);
    const metaInfoName = '1';
    args.push(metaInfoName);
    // Options
    args.push('--memory-io');
    if (options.mergeSegments) {
        options.mergeSegments && args.push('--merge-segments');
    }
    const pipelinePath = path.join(path.dirname(fileURLToPath(import.meta.url)), 'pipelines', 'read-overlapping-segmentation');
    const { returnValue, stderr, outputs } = await runPipelineNode(pipelinePath, args, desiredOutputs, inputs, mountDirs);
    if (returnValue !== 0 && stderr !== "") {
        throw new Error(stderr);
    }
    const result = {
        segImage: outputs[0]?.data,
        metaInfo: outputs[1]?.data,
    };
    return result;
}
export default readOverlappingSegmentationNode;
//# sourceMappingURL=read-overlapping-segmentation-node.js.map