Skip to content

Commit

Permalink
Revise dicom tag retrieve
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmartel committed Jul 17, 2024
1 parent 16eece5 commit 022f3dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 27 deletions.
19 changes: 0 additions & 19 deletions src/app/viewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,25 +321,6 @@ export class ViewController {
return this.#view.getImage().getMeta().pixelUnit;
}

/**
* Get the image study instance UID.
*
* @returns {string} The UID.
*/
getStudyInstanceUID() {
return this.#view.getImage().getMeta().StudyInstanceUID;
}

/**
* Get the image series instance UID.
*
* @returns {string} The UID.
*/
getSeriesInstanceUID() {
return this.#view.getImage().getMeta().SeriesInstanceUID;
}


/**
* Extract a slice from an image at the given index and orientation.
*
Expand Down
14 changes: 6 additions & 8 deletions src/tools/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,19 @@ export class Draw {
if (typeof drawLayer === 'undefined') {
// create new data
const viewLayer = layerGroup.getActiveViewLayer();
const viewController = viewLayer.getViewController();
const refData = this.#app.getData(viewLayer.getDataId());
const refMeta = refData.image.getMeta();
const data = new DicomData({});
data.annotationGroup = new AnnotationGroup();
data.annotationGroup.setMetaValue('Modality', 'SR');
data.annotationGroup.setMetaValue(
'StudyInstanceUID', viewController.getStudyInstanceUID());
'PatientID', refMeta.PatientID);
data.annotationGroup.setMetaValue(
'StudyInstanceUID', refMeta.StudyInstanceUID);
data.annotationGroup.setMetaValue(
'ReferencedSeriesSequence', {
value: [{
SeriesInstanceUID: viewController.getSeriesInstanceUID()
SeriesInstanceUID: refMeta.SeriesInstanceUID
}]
});
const dataId = this.#app.addData(data);
Expand Down Expand Up @@ -635,11 +638,6 @@ export class Draw {
// set annotation shape
this.#currentFactory.setAnnotationMathShape(annotation, finalPoints);

if (!drawController.hasAnnotationMeta('StudyInstanceUID')) {
drawController.setAnnotationMeta(
'StudyInstanceUID', viewController.getStudyInstanceUID());
}

// create add annotation command
const command = new AddAnnotationCommand(annotation, drawController);
// add command to undo stack
Expand Down

0 comments on commit 022f3dd

Please sign in to comment.