导入分割数据与分段进行绑定
continuous-integration/drone/push Build is passing Details

uat_us
wangxiaoshuang 2026-03-25 16:44:55 +08:00
parent 5336cb5353
commit 64d1ebf350
2 changed files with 27 additions and 8 deletions

View File

@ -1585,7 +1585,7 @@ export default {
// }) // })
}, },
renderAnnotations(series) { renderAnnotations(series) {
const taskId = series.TaskInfo.VisitTaskId const taskId = series.TaskInfo ? series.TaskInfo.VisitTaskId : null
if (!taskId || this.renderedTaskIds.includes(taskId)) return if (!taskId || this.renderedTaskIds.includes(taskId)) return
this.renderedTaskIds.push(taskId) this.renderedTaskIds.push(taskId)
const taskIdx = this.visitTaskList.findIndex(i => i.VisitTaskId === taskId) const taskIdx = this.visitTaskList.findIndex(i => i.VisitTaskId === taskId)

View File

@ -305,7 +305,7 @@ export default {
mounted() { mounted() {
this.SegmentHight = window.innerHeight > 900 ? window.innerHeight * 0.5 : window.innerHeight * 0.4; this.SegmentHight = window.innerHeight > 900 ? window.innerHeight * 0.5 : window.innerHeight * 0.4;
this.statsKey = getCustomizeStandardsSegmentDicomTools('Labelmap')[0].props.filter(item => item !== 'width' && item !== 'length') this.statsKey = getCustomizeStandardsSegmentDicomTools('Labelmap')[0].props.filter(item => item !== 'width' && item !== 'length')
console.log(segmentation, 'segmentation') // console.log(segmentation, 'segmentation')
// console.log(annotation, 'annotation') // console.log(annotation, 'annotation')
eventTarget.addEventListener( eventTarget.addEventListener(
'CORNERSTONE_TOOLS_SEGMENTATION_DATA_MODIFIED', 'CORNERSTONE_TOOLS_SEGMENTATION_DATA_MODIFIED',
@ -397,7 +397,6 @@ export default {
segmentationId: item.segmentationId, segmentationId: item.segmentationId,
segmentIndices: [item.segmentIndex], segmentIndices: [item.segmentIndex],
}); });
// console.log(bidirectionalData, 'bidirectionalData')
if (bidirectionalData.length <= 0) { if (bidirectionalData.length <= 0) {
let annotations = annotation.state.getAllAnnotations().filter(i => i.metadata.segmentationId === item.segmentationId && i.metadata.segmentIndex === item.segmentIndex); let annotations = annotation.state.getAllAnnotations().filter(i => i.metadata.segmentationId === item.segmentationId && i.metadata.segmentIndex === item.segmentIndex);
annotations.forEach(i => { annotations.forEach(i => {
@ -906,6 +905,9 @@ export default {
labelmap3D, labelmap3D,
metaData metaData
); );
group.segments.forEach((item, index) => {
generatedSegmentation.dataset.SegmentSequence[index].SegmentNumber = item.segmentIndex.toString()
})
if (!isFile) { if (!isFile) {
const buffer = Buffer.from(dcmjs.data.datasetToDict(generatedSegmentation.dataset).write()); const buffer = Buffer.from(dcmjs.data.datasetToDict(generatedSegmentation.dataset).write());
let blob = new Blob([buffer], { type: "application/dicom" }); let blob = new Blob([buffer], { type: "application/dicom" });
@ -971,7 +973,6 @@ export default {
arrayBuffer, arrayBuffer,
metaData, metaData,
); );
if (generateToolState.labelmapBufferArray.length !== 1) { if (generateToolState.labelmapBufferArray.length !== 1) {
alert( alert(
"Overlapping segments in your segmentation are not supported yet. You can turn on the skipOverlapping option but it will override the overlapping segments." "Overlapping segments in your segmentation are not supported yet. You can turn on the skipOverlapping option but it will override the overlapping segments."
@ -991,12 +992,28 @@ export default {
const volumeScalarData = new Uint8Array( const volumeScalarData = new Uint8Array(
generateToolState.labelmapBufferArray[0] generateToolState.labelmapBufferArray[0]
); );
const remappedData = new Uint8Array(volumeScalarData.length);
let mapping = {}
let segments = await this.getSegmentList(segmentationId)
if (segments.length > 0) {
segments.forEach(item => {
let SegmentJson = item.SegmentJson ? JSON.parse(item.SegmentJson) : {};
if (SegmentJson.bidirectional && SegmentJson.stats) {
let keys = Object.keys(mapping)
mapping[keys.length + 1] = Number(item.SegmentMumber)
}
})
}
for (let i = 0; i < volumeScalarData.length; i++) {
const value = volumeScalarData[i];
remappedData[i] = value === 0 ? 0 : (mapping[value] ? mapping[value] : 0);
}
for (let i = 0; i < derivedSegmentationImages.length; i++) { for (let i = 0; i < derivedSegmentationImages.length; i++) {
const voxelManager = derivedSegmentationImages[i].voxelManager; const voxelManager = derivedSegmentationImages[i].voxelManager;
const scalarData = voxelManager.getScalarData(); const scalarData = voxelManager.getScalarData();
scalarData.set( scalarData.set(
volumeScalarData.slice( remappedData.slice(
i * scalarData.length, i * scalarData.length,
(i + 1) * scalarData.length (i + 1) * scalarData.length
) )
@ -1227,6 +1244,7 @@ export default {
}) })
// //
let blob = this.exportSegmentation(segmentGroup.segmentationId, segmentGroup) let blob = this.exportSegmentation(segmentGroup.segmentationId, segmentGroup)
// if (!blob) return false
if (blob) { if (blob) {
let path = `/${this.$route.query.trialId}/Segment/${this.visitInfo.SubjectId let path = `/${this.$route.query.trialId}/Segment/${this.visitInfo.SubjectId
}/${this.visitInfo.VisistId}/${this.series.StudyId }/${this.visitInfo.VisistId}/${this.series.StudyId
@ -1328,13 +1346,14 @@ export default {
// this.getBidirectional(o) // this.getBidirectional(o)
// }) // })
if (SEGMENT && index === segments.length - 1) { if (SEGMENT && index === segments.length - 1) {
console.log(SEGMENT, 'SEGMENT') // console.log(SEGMENT, 'SEGMENT')
return this.getBidirectional(o, SEGMENT) return this.getBidirectional(o, SEGMENT)
} }
this.getBidirectional(o) this.getBidirectional(o)
}) })
} }
} }
// console.log(segmentation.state.getSegmentations(), 'segmentation.state.getSegmentations()')
} catch (err) { } catch (err) {
this.loading = false this.loading = false
console.log(err) console.log(err)