File tree 1 file changed +19
-4
lines changed
1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -170,7 +170,14 @@ export default class MeasurementReport {
170
170
return report ;
171
171
}
172
172
173
- static generateToolState ( dataset ) {
173
+ /**
174
+ * Generate Cornerstone tool state from dataset
175
+ * @param {object } dataset dataset
176
+ * @param {object } hooks
177
+ * @param {object } hooks.getToolClass Function to map dataset to a tool class
178
+ * @returns
179
+ */
180
+ static generateToolState ( dataset , hooks = { } ) {
174
181
// For now, bail out if the dataset is not a TID1500 SR with length measurements
175
182
if ( dataset . ContentTemplateSequence . TemplateIdentifier !== "1500" ) {
176
183
throw new Error (
@@ -218,9 +225,17 @@ export default class MeasurementReport {
218
225
219
226
const TrackingIdentifierValue = TrackingIdentifierGroup . TextValue ;
220
227
221
- const toolClass = registeredToolClasses . find ( tc =>
222
- tc . isValidCornerstoneTrackingIdentifier ( TrackingIdentifierValue )
223
- ) ;
228
+ const toolClass = hooks . getToolClass
229
+ ? hooks . getToolClass (
230
+ measurementGroup ,
231
+ dataset ,
232
+ registeredToolClasses
233
+ )
234
+ : registeredToolClasses . find ( tc =>
235
+ tc . isValidCornerstoneTrackingIdentifier (
236
+ TrackingIdentifierValue
237
+ )
238
+ ) ;
224
239
225
240
if ( toolClass ) {
226
241
const measurement = toolClass . getMeasurementData (
You can’t perform that action at this time.
0 commit comments