Skip to content

Commit

Permalink
fix(PET vs PT): Change all to PT for consistency (#676)
Browse files Browse the repository at this point in the history
* fix(PET vs PT): Change all to PT for consistency

* update api
  • Loading branch information
sedghi authored Jul 4, 2023
1 parent 9eb70d9 commit 813e5ba
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 38 deletions.
14 changes: 7 additions & 7 deletions common/reviews/api/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ interface IImage {
rows: number;
// (undocumented)
scaling?: {
PET?: {
PT?: {
SUVlbmFactor?: number;
SUVbsaFactor?: number;
suvbwToSuvlbm?: number;
Expand Down Expand Up @@ -1199,7 +1199,7 @@ interface IImageVolume {
// (undocumented)
isDynamicVolume(): boolean;
// (undocumented)
isPrescaled: boolean;
isPreScaled: boolean;
// (undocumented)
loadStatus?: Record<string, any>;
// (undocumented)
Expand All @@ -1212,7 +1212,7 @@ interface IImageVolume {
referencedVolumeId?: string;
// (undocumented)
scaling?: {
PET?: {
PT?: {
SUVlbmFactor?: number;
SUVbsaFactor?: number;
suvbwToSuvlbm?: number;
Expand Down Expand Up @@ -1432,7 +1432,7 @@ export class ImageVolume implements IImageVolume {
// (undocumented)
isDynamicVolume(): boolean;
// (undocumented)
isPrescaled: boolean;
isPreScaled: boolean;
// (undocumented)
loadStatus?: Record<string, any>;
// (undocumented)
Expand All @@ -1447,7 +1447,7 @@ export class ImageVolume implements IImageVolume {
protected scalarData: VolumeScalarData | Array<VolumeScalarData>;
// (undocumented)
scaling?: {
PET?: {
PT?: {
SUVlbmFactor?: number;
SUVbsaFactor?: number;
suvbwToSuvlbm?: number;
Expand Down Expand Up @@ -1760,7 +1760,7 @@ interface IVolume {
scalarData: VolumeScalarData | Array<VolumeScalarData>;
// (undocumented)
scaling?: {
PET?: {
PT?: {
SUVlbmFactor?: number;
SUVbsaFactor?: number;
suvbwToSuvlbm?: number;
Expand Down Expand Up @@ -2104,7 +2104,7 @@ function scaleRGBTransferFunction(rgbTransferFunction: any, scalingFactor: numbe

// @public (undocumented)
type Scaling = {
PET?: PTScaling;
PT?: PTScaling;
};

// @public (undocumented)
Expand Down
10 changes: 5 additions & 5 deletions common/reviews/api/streaming-image-volume-loader.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ interface IImage {
rowPixelSpacing: number;
rows: number;
scaling?: {
PET?: {
PT?: {
// @TODO: Do these values exist?
SUVlbmFactor?: number;
SUVbsaFactor?: number;
Expand Down Expand Up @@ -842,14 +842,14 @@ interface IImageVolume {
imageData?: vtkImageData;
imageIds: Array<string>;
isDynamicVolume(): boolean;
isPrescaled: boolean;
isPreScaled: boolean;
loadStatus?: Record<string, any>;
metadata: Metadata;
numVoxels: number;
origin: Point3;
referencedVolumeId?: string;
scaling?: {
PET?: {
PT?: {
SUVlbmFactor?: number;
SUVbsaFactor?: number;
suvbwToSuvlbm?: number;
Expand Down Expand Up @@ -1207,7 +1207,7 @@ interface IVolume {
referencedVolumeId?: string;
scalarData: VolumeScalarData | Array<VolumeScalarData>;
scaling?: {
PET?: {
PT?: {
// @TODO: Do these values exist?
SUVlbmFactor?: number;
SUVbsaFactor?: number;
Expand Down Expand Up @@ -1415,7 +1415,7 @@ type RGB = [number, number, number];

// @public (undocumented)
type Scaling = {
PET?: PTScaling;
PT?: PTScaling;
};

// @public (undocumented)
Expand Down
10 changes: 5 additions & 5 deletions common/reviews/api/tools.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2467,7 +2467,7 @@ interface IImage {
rowPixelSpacing: number;
rows: number;
scaling?: {
PET?: {
PT?: {
// @TODO: Do these values exist?
SUVlbmFactor?: number;
SUVbsaFactor?: number;
Expand Down Expand Up @@ -2543,14 +2543,14 @@ interface IImageVolume {
imageData?: vtkImageData;
imageIds: Array<string>;
isDynamicVolume(): boolean;
isPrescaled: boolean;
isPreScaled: boolean;
loadStatus?: Record<string, any>;
metadata: Metadata;
numVoxels: number;
origin: Point3;
referencedVolumeId?: string;
scaling?: {
PET?: {
PT?: {
SUVlbmFactor?: number;
SUVbsaFactor?: number;
suvbwToSuvlbm?: number;
Expand Down Expand Up @@ -3068,7 +3068,7 @@ interface IVolume {
referencedVolumeId?: string;
scalarData: VolumeScalarData | Array<VolumeScalarData>;
scaling?: {
PET?: {
PT?: {
// @TODO: Do these values exist?
SUVlbmFactor?: number;
SUVbsaFactor?: number;
Expand Down Expand Up @@ -4420,7 +4420,7 @@ export class ScaleOverlayTool extends AnnotationDisplayTool {

// @public (undocumented)
type Scaling = {
PET?: PTScaling;
PT?: PTScaling;
};

// @public (undocumented)
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/RenderingEngine/StackViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1289,25 +1289,25 @@ class StackViewport extends Viewport implements IStackViewport {
* @param imageIdScalingFactor - suvbw, suvlbm, suvbsa
*/
private _addScalingToViewport(imageIdScalingFactor) {
if (this.scaling.PET) {
if (this.scaling.PT) {
return;
}

// if don't exist
// These ratios are constant across all frames, so only need one.
const { suvbw, suvlbm, suvbsa } = imageIdScalingFactor;

const petScaling = <PTScaling>{};
const ptScaling = <PTScaling>{};

if (suvlbm) {
petScaling.suvbwToSuvlbm = suvlbm / suvbw;
ptScaling.suvbwToSuvlbm = suvlbm / suvbw;
}

if (suvbsa) {
petScaling.suvbwToSuvbsa = suvbsa / suvbw;
ptScaling.suvbwToSuvbsa = suvbsa / suvbw;
}

this.scaling.PET = petScaling;
this.scaling.PT = ptScaling;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/RenderingEngine/VolumeViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import vtkPlane from '@kitware/vtk.js/Common/DataModel/Plane';
import { vec3 } from 'gl-matrix';

import cache from '../cache';
import { EPSILON, MPR_CAMERA_VALUES, RENDERING_DEFAULTS } from '../constants';
import { MPR_CAMERA_VALUES, RENDERING_DEFAULTS } from '../constants';
import { BlendModes, OrientationAxis } from '../enums';
import type {
ActorEntry,
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/cache/classes/ImageVolume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export class ImageVolume implements IImageVolume {

/** Read-only unique identifier for the volume */
readonly volumeId: string;

isPreScaled = false;

/** Dimensions of the volume */
dimensions: Point3;
/** volume direction in world space */
Expand All @@ -32,10 +35,9 @@ export class ImageVolume implements IImageVolume {
/** volume origin, Note this is an opinionated origin for the volume */
origin: Point3;
/** Whether preScaling has been performed on the volume */
isPrescaled = false;
/** volume scaling parameters if it contains scaled data */
scaling?: {
PET?: {
PT?: {
// @TODO: Do these values exist?
SUVlbmFactor?: number;
SUVbsaFactor?: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/types/IImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ interface IImage {
colormap?: CPUFallbackColormap;
/** image scaling metadata - including PT suv values */
scaling?: {
PET?: {
PT?: {
// @TODO: Do these values exist?
SUVlbmFactor?: number;
SUVbsaFactor?: number;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/types/IImageVolume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ interface IImageVolume {
/** volume origin - set to the imagePositionPatient of the last image in the volume */
origin: Point3;
/** Whether preScaling has been performed on the volume */
isPrescaled: boolean;
isPreScaled: boolean;
/** volume scaling metadata */
scaling?: {
PET?: {
PT?: {
SUVlbmFactor?: number;
SUVbsaFactor?: number;
suvbwToSuvlbm?: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/types/IVolume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface IVolume {
referencedVolumeId?: string;
/** volume scaling metadata */
scaling?: {
PET?: {
PT?: {
// @TODO: Do these values exist?
SUVlbmFactor?: number;
SUVbsaFactor?: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/types/ScalingParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type PTScaling = {
};

type Scaling = {
PET?: PTScaling;
PT?: PTScaling;
};

export { PTScaling, Scaling, ScalingParameters };
2 changes: 1 addition & 1 deletion packages/core/test/stackViewport_gpu_render_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ describe('renderingCore -- Stack', () => {

const vp = this.renderingEngine.getViewport(viewportId);
element.addEventListener(Events.IMAGE_RENDERED, () => {
expect(vp.scaling.PET).toEqual({
expect(vp.scaling.PT).toEqual({
suvbwToSuvlbm: 1,
suvbwToSuvbsa: 1,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ export default class BaseStreamingImageVolume extends ImageVolume {
* somehow indicate whether the PT image has been corrected with suvbw or
* not, which we store it in the this.scaling.PT.suvbw.
*/
this.isPrescaled = isSlopeAndInterceptNumbers;
this.isPreScaled = isSlopeAndInterceptNumbers;

const options = {
// WADO Image Loader
Expand Down Expand Up @@ -767,7 +767,7 @@ export default class BaseStreamingImageVolume extends ImageVolume {
petScaling.suvbw = suvbw;
}

this.scaling = { PET: petScaling };
this.scaling = { PT: petScaling };
}

private _removeFromCache() {
Expand Down
8 changes: 4 additions & 4 deletions packages/tools/src/tools/annotation/ProbeTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,11 +579,11 @@ class ProbeTool extends AnnotationTool {
// Check if we have scaling for the other 2 SUV types for the PET.
if (
modality === 'PT' &&
imageVolume.scaling?.PET &&
(imageVolume.scaling.PET.suvbwToSuvbsa ||
imageVolume.scaling.PET.suvbwToSuvlbm)
imageVolume.scaling?.PT &&
(imageVolume.scaling.PT.suvbwToSuvbsa ||
imageVolume.scaling.PT.suvbwToSuvlbm)
) {
const { suvbwToSuvlbm, suvbwToSuvbsa } = imageVolume.scaling.PET;
const { suvbwToSuvlbm, suvbwToSuvbsa } = imageVolume.scaling.PT;

values['SUVBw'] = value;

Expand Down
2 changes: 1 addition & 1 deletion packages/tools/src/tools/base/AnnotationTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ abstract class AnnotationTool extends AnnotationDisplayTool {
if (viewport instanceof BaseVolumeViewport) {
const volumeId = targetId.split('volumeId:')[1];
const volume = cache.getVolume(volumeId);
return volume.scaling?.PET !== undefined;
return volume.scaling?.PT !== undefined;
} else if (viewport instanceof StackViewport) {
const scalingModule: Types.ScalingParameters | undefined =
imageId && metaData.get('scalingModule', imageId);
Expand Down

0 comments on commit 813e5ba

Please sign in to comment.