Skip to content

Commit

Permalink
feat: Add referenceVolume name to labelmaps
Browse files Browse the repository at this point in the history
  • Loading branch information
sedghi authored and swederik committed Mar 22, 2022
1 parent 7d30510 commit afe8add
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/cornerstone-render/src/cache/classes/ImageVolume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class ImageVolume implements IImageVolume {
vtkOpenGLTexture: any // No good way of referencing vtk classes as they aren't classes.
loadStatus?: Record<string, any>
imageIds?: Array<string>
referenceVolumeUID?: string

constructor(props: IVolume) {
this.uid = props.uid
Expand All @@ -44,6 +45,10 @@ export class ImageVolume implements IImageVolume {
if (props.scaling) {
this.scaling = props.scaling
}

if (props.referenceVolumeUID) {
this.referenceVolumeUID = props.referenceVolumeUID
}
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/cornerstone-render/src/types/IImageVolume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface IImageVolume {
vtkOpenGLTexture: any
loadStatus?: Record<string, any>
imageIds?: Array<string>
referenceVolumeUID?: string // if voluem is derived from another volume
convertToCornerstoneImage?: (
imageId: string,
imageIdIndex: number
Expand Down
1 change: 1 addition & 0 deletions packages/cornerstone-render/src/types/IVolume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface IVolume {
scalarData: Float32Array | Uint8Array
sizeInBytes?: number
imageData?: vtkImageData
referenceVolumeUID?: string // if volume is derived
scaling?: {
PET?: {
// @TODO: Do these values exist?
Expand Down
1 change: 1 addition & 0 deletions packages/cornerstone-render/src/volumeLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ export function createAndCacheDerivedVolume(
vtkImageData: derivedImageData,
scalarData: volumeScalarData,
sizeInBytes: numBytes,
referenceVolumeUID: referencedVolumeUID,
})

const volumeLoadObject = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ function calculateSuvPeak(

let max = 0
let maxIJK = [0, 0, 0]
let maxLPS = [0, 0, 0]

const callback = ({ pointIJK }) => {
const callback = ({ pointIJK, pointLPS }) => {
const offset = referenceVolumeImageData.computeOffsetIndex(pointIJK)
const value = labelmapData[offset]

Expand All @@ -74,6 +75,7 @@ function calculateSuvPeak(
if (referenceValue > max) {
max = referenceValue
maxIJK = pointIJK
maxLPS = pointLPS
}
}

Expand Down Expand Up @@ -125,6 +127,7 @@ function calculateSuvPeak(
return {
max,
maxIJK,
maxLPS,
mean,
}
}
Expand Down

0 comments on commit afe8add

Please sign in to comment.