-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cornerstone): Feature add cornerstone adapters (#225)
* feature(dcmjs): Adding cobb-angle support * feat(dcmjs): Add adapter for CobbAngle, and add description and location mapping * fix(dcmjs): Fix the arrow, cobb and length to all get the description/group in the same way * feat(dcmjs):Add adapters for FreehandRoi, RectangleRoi and Angle * fix(dcmjs): Fixed the angle and rectangle cornerstone adapters * fix(dcmjs): Store an optional second point for the arrow annotation The point TID300 normally takes 1 point, but seems to be ok if an extra one is added for the source of the indicator. * fix(dcmjs):Use the SCT codes rather than SRT as requested
- Loading branch information
1 parent
70b2433
commit c65b930
Showing
15 changed files
with
565 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import MeasurementReport from "./MeasurementReport.js"; | ||
import TID300CobbAngle from "../../utilities/TID300/CobbAngle.js"; | ||
import CORNERSTONE_4_TAG from "./cornerstone4Tag"; | ||
|
||
const ANGLE = "Angle"; | ||
|
||
class Angle { | ||
constructor() {} | ||
|
||
/** | ||
* Generate TID300 measurement data for a plane angle measurement - use a CobbAngle, but label it as Angle | ||
* @param MeasurementGroup | ||
* @returns | ||
*/ | ||
static getMeasurementData(MeasurementGroup) { | ||
const { | ||
defaultState, | ||
NUMGroup, | ||
SCOORDGroup | ||
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup); | ||
|
||
const state = { | ||
...defaultState, | ||
rAngle: NUMGroup.MeasuredValueSequence.NumericValue, | ||
toolType: Angle.toolType, | ||
handles: { | ||
start: {}, | ||
middle: {}, | ||
end: {}, | ||
textBox: { | ||
hasMoved: false, | ||
movesIndependently: false, | ||
drawnIndependently: true, | ||
allowedOutsideImage: true, | ||
hasBoundingBox: true | ||
} | ||
} | ||
}; | ||
|
||
[ | ||
state.handles.start.x, | ||
state.handles.start.y, | ||
state.handles.middle.x, | ||
state.handles.middle.y, | ||
state.handles.middle.x, | ||
state.handles.middle.y, | ||
state.handles.end.x, | ||
state.handles.end.y | ||
] = SCOORDGroup.GraphicData; | ||
|
||
return state; | ||
} | ||
|
||
static getTID300RepresentationArguments(tool) { | ||
const { handles, finding, findingSites } = tool; | ||
const point1 = handles.start; | ||
const point2 = handles.middle; | ||
const point3 = handles.middle; | ||
const point4 = handles.end; | ||
const rAngle = tool.rAngle; | ||
|
||
const trackingIdentifierTextValue = "cornerstoneTools@^4.0.0:Angle"; | ||
|
||
return { | ||
point1, | ||
point2, | ||
point3, | ||
point4, | ||
rAngle, | ||
trackingIdentifierTextValue, | ||
finding, | ||
findingSites: findingSites || [] | ||
}; | ||
} | ||
} | ||
|
||
Angle.toolType = ANGLE; | ||
Angle.utilityToolType = ANGLE; | ||
Angle.TID300Representation = TID300CobbAngle; | ||
Angle.isValidCornerstoneTrackingIdentifier = TrackingIdentifier => { | ||
if (!TrackingIdentifier.includes(":")) { | ||
return false; | ||
} | ||
|
||
const [cornerstone4Tag, toolType] = TrackingIdentifier.split(":"); | ||
|
||
if (cornerstone4Tag !== CORNERSTONE_4_TAG) { | ||
return false; | ||
} | ||
|
||
return toolType === ANGLE; | ||
}; | ||
|
||
MeasurementReport.registerTool(Angle); | ||
|
||
export default Angle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import MeasurementReport from "./MeasurementReport.js"; | ||
import TID300CobbAngle from "../../utilities/TID300/CobbAngle.js"; | ||
import CORNERSTONE_4_TAG from "./cornerstone4Tag"; | ||
|
||
const COBB_ANGLE = "CobbAngle"; | ||
|
||
class CobbAngle { | ||
constructor() {} | ||
|
||
// TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport. | ||
static getMeasurementData(MeasurementGroup) { | ||
const { | ||
defaultState, | ||
NUMGroup, | ||
SCOORDGroup | ||
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup); | ||
|
||
const state = { | ||
...defaultState, | ||
rAngle: NUMGroup.MeasuredValueSequence.NumericValue, | ||
toolType: CobbAngle.toolType, | ||
handles: { | ||
start: {}, | ||
end: {}, | ||
start2: { | ||
highlight: true, | ||
drawnIndependently: true | ||
}, | ||
end2: { | ||
highlight: true, | ||
drawnIndependently: true | ||
}, | ||
textBox: { | ||
hasMoved: false, | ||
movesIndependently: false, | ||
drawnIndependently: true, | ||
allowedOutsideImage: true, | ||
hasBoundingBox: true | ||
} | ||
} | ||
}; | ||
|
||
[ | ||
state.handles.start.x, | ||
state.handles.start.y, | ||
state.handles.end.x, | ||
state.handles.end.y, | ||
state.handles.start2.x, | ||
state.handles.start2.y, | ||
state.handles.end2.x, | ||
state.handles.end2.y | ||
] = SCOORDGroup.GraphicData; | ||
|
||
return state; | ||
} | ||
|
||
static getTID300RepresentationArguments(tool) { | ||
const { handles, finding, findingSites } = tool; | ||
const point1 = handles.start; | ||
const point2 = handles.end; | ||
const point3 = handles.start2; | ||
const point4 = handles.end2; | ||
const rAngle = tool.rAngle; | ||
|
||
const trackingIdentifierTextValue = "cornerstoneTools@^4.0.0:CobbAngle"; | ||
|
||
return { | ||
point1, | ||
point2, | ||
point3, | ||
point4, | ||
rAngle, | ||
trackingIdentifierTextValue, | ||
finding, | ||
findingSites: findingSites || [] | ||
}; | ||
} | ||
} | ||
|
||
CobbAngle.toolType = COBB_ANGLE; | ||
CobbAngle.utilityToolType = COBB_ANGLE; | ||
CobbAngle.TID300Representation = TID300CobbAngle; | ||
CobbAngle.isValidCornerstoneTrackingIdentifier = TrackingIdentifier => { | ||
if (!TrackingIdentifier.includes(":")) { | ||
return false; | ||
} | ||
|
||
const [cornerstone4Tag, toolType] = TrackingIdentifier.split(":"); | ||
|
||
if (cornerstone4Tag !== CORNERSTONE_4_TAG) { | ||
return false; | ||
} | ||
|
||
return toolType === COBB_ANGLE; | ||
}; | ||
|
||
MeasurementReport.registerTool(CobbAngle); | ||
|
||
export default CobbAngle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.