Skip to content

Commit

Permalink
Can remove colormapLabel
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Feb 23, 2024
1 parent 03787e6 commit 54c1132
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/NiivueMutator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,14 @@ class NiivueMutator {
*/
private setColormapLabel(
volume: NVRVolume,
colormapLabel: undefined | ColorMap,
colormapLabel: undefined | null | ColorMap,
) {
if (colormapLabel === undefined) {
throw new Error(
`colormapLabel is undefined, and unsetting of a colormapLabel is not supported.`,
);
}
const targetImage = this.nv.getMediaByUrl(volume.url) as NVImage;
targetImage.setColormapLabel(colormapLabel);
if (colormapLabel === undefined || colormapLabel === null) {
targetImage.colormapLabel = null;
} else {
targetImage.setColormapLabel(colormapLabel);
}
this.nv.updateGLVolume();
}

Expand Down
2 changes: 1 addition & 1 deletion src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type SpecialVolumeOptions = {
*
* Example value: {@link FreeSurferColorLUT}
*/
colormapLabel?: ColorMap;
colormapLabel?: ColorMap | null;
};

/**
Expand Down

0 comments on commit 54c1132

Please sign in to comment.