I want to export a file in rtstruct format, but I don’t know how to proceed.
I’ve seen in the adapters folder a RTStuct folder and I want to export the file to have a RTStruct
In the example the button execute this
addButtonToToolbar({
title: "EXPORT",
onClick: async () => {
const volume = cache.getVolume(volumeId);
const segUID = segmentationRepresentationUID[0];
const images = volume.getCornerstoneImages();
const labelmapObj =
Cornerstone3D.Segmentation.generateLabelMaps2DFrom3D(
segmentationVolume
);
// Generate fake metadata as an example
labelmapObj.metadata = [];
labelmapObj.segmentsOnLabelmap.forEach(segmentIndex => {
const color = segmentation.config.color.getColorForSegmentIndex(
toolGroupId,
segUID,
segmentIndex
);
const segmentMetadata = generateMockMetadata(segmentIndex, color);
labelmapObj.metadata[segmentIndex] = segmentMetadata;
});
const generatedSegmentation =
Cornerstone3D.Segmentation.generateSegmentation(
images,
labelmapObj,
metaData
);
downloadDICOMData(generatedSegmentation.dataset, "mySEG.dcm");
}
});
with this I can export a SEG but I want to export a RTSTRUCT
This is what I tried to export but getSegmentation does not exist and I don’t know how to achieve this.
addButtonToToolbar({
title: "EXPORTAR",
onClick: async () => {
const volume = cache.getVolume(volumeId);
const segUID = segmentationRepresentationUID[0];
const images = volume.getCornerstoneImages();
console.log(volume);
// Get the segmentation object.
const segmentation = volume.getSegmentation(segUID);
// Get the metadata provider.
const metadataProvider = Cornerstone3D.MetadataProvider.getDefault();
// Get the DICOM metadata store.
const DicomMetadataStore = Cornerstone3D.DicomMetadataStore.getDefault();
// Get the Cornerstone cache.
const cornerstoneCache = Cornerstone3D.CornerstoneCache.getDefault();
// Get the Cornerstone tools enums.
const cornerstoneToolsEnums = Cornerstone3D.CornerstoneToolsEnums.getDefault();
// Get the VTK utils.
const vtkUtils = Cornerstone3D.VTKUtils.getDefault()
// Generate the RTSTRUCT report.
const rtsReport = generateRTSSFromSegmentations(
[segmentation], // Array of segmentations.
metadataProvider, // Metadata provider.
DicomMetadataStore, // DICOM metadata store instance.
cornerstoneCache, // Cornerstone cache instance.
cornerstoneToolsEnums, // Cornerstone tools enums.
vtkUtils // VTK utils.
);
// Get the DICOM dataset from the RTSTRUCT report.
const dataset = rtsReport.dataset;
// Export the RTSTRUCT file.
downloadDICOMData(dataset, "myRTSTRUCT.dcm");
Could you please help me?