Skip to content

Commit 1e50a4a

Browse files
authored
fix: 🐛 ReferenceError: fracToDec is not defined (#51)
Closes: #50
1 parent 6b921b5 commit 1e50a4a

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

examples/VTKBasicExample.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import vtkVolumeMapper from 'vtk.js/Sources/Rendering/Core/VolumeMapper';
1212
const PRESETS = {
1313
BONE: {
1414
windowWidth: 100,
15-
windowCenter: 500,
15+
windowCenter: 500 + 1024, // TODO: The data we load is unscaled, so we need to move our preset.
1616
},
1717
HEAD: {
1818
windowWidth: 1000,
19-
windowCenter: 300,
19+
windowCenter: 300 + 1024, // TODO: The data we load is unscaled, so we need to move our preset.
2020
},
2121
};
2222
class VTKBasicExample extends Component {
@@ -51,6 +51,9 @@ class VTKBasicExample extends Component {
5151

5252
const volume = this.state.volumes[0];
5353
const rgbTransferFunction = volume.getProperty().getRGBTransferFunction(0);
54+
55+
this.state.volume;
56+
5457
const low = voi.windowCenter - voi.windowWidth / 2;
5558
const high = voi.windowCenter + voi.windowWidth / 2;
5659

src/lib/data/insertSlice.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ function _getScalingFunctionForModality(image) {
9191
}
9292

9393
const acquisitionTimeInSeconds =
94-
fracToDec(seriesAcquisitionTime.fractionalSeconds || 0) +
94+
_fracToDec(seriesAcquisitionTime.fractionalSeconds || 0) +
9595
seriesAcquisitionTime.seconds +
9696
seriesAcquisitionTime.minutes * 60 +
9797
seriesAcquisitionTime.hours * 60 * 60;
9898
const injectionStartTimeInSeconds =
99-
fracToDec(startTime.fractionalSeconds) +
99+
_fracToDec(startTime.fractionalSeconds) +
100100
startTime.seconds +
101101
startTime.minutes * 60 +
102102
startTime.hours * 60 * 60;
@@ -120,3 +120,16 @@ function _getSUV(slope, intercept, patientWeight, correctedDose, pixel) {
120120
function _getModalityScaledPixel(slope, intercept, pixel) {
121121
return pixel * slope + intercept;
122122
}
123+
124+
/**
125+
* Returns a decimal value given a fractional value.
126+
* @private
127+
* @method
128+
* @name _fracToDec
129+
*
130+
* @param {number} fractionalValue The value to convert.
131+
* @returns {number} The value converted to decimal.
132+
*/
133+
function _fracToDec(fractionalValue) {
134+
return parseFloat(`.${fractionalValue}`);
135+
}

src/lib/loadImageData.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,6 @@ function loadImageDataProgressively(imageIds, imageData, metaDataMap, zAxis) {
2727
return Promise.all(loadImagePromises);
2828
}
2929

30-
/**
31-
* Returns a decimal value given a fractional value.
32-
* @private
33-
* @method
34-
* @name fracToDec
35-
*
36-
* @param {number} fractionalValue The value to convert.
37-
* @returns {number} The value converted to decimal.
38-
*/
39-
function fracToDec(fractionalValue) {
40-
return parseFloat(`.${fractionalValue}`);
41-
}
42-
4330
export default function loadImageData(imageDataObject) {
4431
return loadImageDataProgressively(
4532
imageDataObject.imageIds,

0 commit comments

Comments
 (0)