-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: unify handling of annotation units and remove 'MO' (#161)
* fix: unify handling of annotation units and remove 'MO' * fix: only use SUV as PT unit if image is pre-scaled
- Loading branch information
Showing
8 changed files
with
110 additions
and
106 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
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
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
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,11 @@ | ||
function getModalityUnit(modality: string, isPreScaled: boolean): string { | ||
if (modality === 'CT') { | ||
return 'HU'; | ||
} else if (modality === 'PT' && isPreScaled === true) { | ||
return 'SUV'; | ||
} else { | ||
return ''; | ||
} | ||
} | ||
|
||
export { getModalityUnit }; |
24 changes: 24 additions & 0 deletions
24
packages/tools/src/utilities/viewport/isViewportPreScaled.ts
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,24 @@ | ||
import { | ||
cache, | ||
StackViewport, | ||
Types, | ||
VolumeViewport, | ||
} from '@cornerstonejs/core'; | ||
|
||
function isViewportPreScaled( | ||
viewport: Types.IStackViewport | Types.IVolumeViewport, | ||
targetId: string | ||
): boolean { | ||
if (viewport instanceof VolumeViewport) { | ||
const volumeId = targetId.split('volumeId:')[1]; | ||
const volume = cache.getVolume(volumeId); | ||
return volume.scaling && Object.keys(volume.scaling).length > 0; | ||
} else if (viewport instanceof StackViewport) { | ||
const { preScale } = viewport.getImageData(); | ||
return preScale.scaled; | ||
} else { | ||
throw new Error('Viewport is not a valid type'); | ||
} | ||
} | ||
|
||
export { isViewportPreScaled }; |