@cornerstonejs/nifti-volume-loader 5.8.2 → 5.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import * as NiftiReader from 'nifti-reader-js';
3
3
  import { Events } from './enums/index.js';
4
4
  import { modalityScaleNifti } from './helpers/index.js';
5
5
  import { getOptions } from './internal/index.js';
6
+ const cs3dLogger = utilities.logger.niftiVolumeLoaderLog.getLogger('cornerstoneNiftiImageLoader');
6
7
  const dataFetchStateMap = new Map();
7
8
  function fetchArrayBuffer({ url, signal, onload, }) {
8
9
  return new Promise(async (resolve, reject) => {
@@ -90,7 +91,7 @@ async function fetchAndProcessNiftiData(imageId, url, sliceIndex, imagePixelModu
90
91
  }
91
92
  else {
92
93
  const errorMessage = 'The provided buffer is not a valid NIFTI file.';
93
- console.warn(errorMessage);
94
+ cs3dLogger.warn(errorMessage);
94
95
  throw new Error(errorMessage);
95
96
  }
96
97
  const { scalarData } = modalityScaleNifti(niftiHeader, niftiImage);
@@ -6,6 +6,7 @@ import { NIFTI_LOADER_SCHEME } from './constants/index.js';
6
6
  import makeVolumeMetadata from './helpers/makeVolumeMetadata.js';
7
7
  import { getArrayConstructor } from './helpers/dataTypeCodeHelper.js';
8
8
  import { getOptions } from './internal/index.js';
9
+ const cs3dLogger = utilities.logger.niftiVolumeLoaderLog.getLogger('createNiftiImageIdsAndCacheMetadata');
9
10
  export const urlsMap = new Map();
10
11
  const NIFTI1_HEADER_SIZE = 348;
11
12
  const NIFTI2_HEADER_SIZE = 540;
@@ -41,7 +42,7 @@ export async function fetchArrayBuffer({ url, onProgress, controller, onLoad, on
41
42
  const decompressionWriter = decompressionStream
42
43
  ? decompressionStream.writable.getWriter()
43
44
  : null;
44
- readStream(reader, decompressionWriter, isCompressed, receivedLength, processChunk, controller).catch(console.error);
45
+ readStream(reader, decompressionWriter, isCompressed, receivedLength, processChunk, controller).catch(cs3dLogger.error);
45
46
  if (isCompressed) {
46
47
  const decompressedStream = decompressionStream.readable.getReader();
47
48
  while (true) {
@@ -63,10 +64,10 @@ export async function fetchArrayBuffer({ url, onProgress, controller, onLoad, on
63
64
  }
64
65
  catch (error) {
65
66
  if (error.name === 'AbortError') {
66
- console.log('Fetch aborted');
67
+ cs3dLogger.info('Fetch aborted');
67
68
  }
68
69
  else {
69
- console.error('Fetch error:', error);
70
+ cs3dLogger.error('Fetch error:', error);
70
71
  }
71
72
  throw error;
72
73
  }
@@ -138,7 +139,7 @@ function handleNiftiHeader(data) {
138
139
  };
139
140
  }
140
141
  catch (error) {
141
- console.error('Error reading Nifti header:', error);
142
+ cs3dLogger.error('Error reading Nifti header:', error);
142
143
  return { isValid: false, message: 'Error reading Nifti header' };
143
144
  }
144
145
  }
@@ -166,7 +167,7 @@ async function fetchAndAllocateNiftiVolume(url) {
166
167
  const { dimensions, direction, isValid, message, origin, version, header, spacing, arrayConstructor, } = niftiHeader;
167
168
  const numImages = dimensions[2];
168
169
  if (!isValid) {
169
- console.error(message);
170
+ cs3dLogger.error(message);
170
171
  return;
171
172
  }
172
173
  const imageIds = [];
@@ -1 +1 @@
1
- export declare const version = "5.8.2";
1
+ export declare const version = "5.10.2";
@@ -1 +1 @@
1
- export const version = '5.8.2';
1
+ export const version = '5.10.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/nifti-volume-loader",
3
- "version": "5.8.2",
3
+ "version": "5.10.2",
4
4
  "description": "Nifti Image Loader for Cornerstone3D",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -73,10 +73,10 @@
73
73
  "nifti-reader-js": "0.6.9"
74
74
  },
75
75
  "devDependencies": {
76
- "@cornerstonejs/core": "5.8.2"
76
+ "@cornerstonejs/core": "5.10.2"
77
77
  },
78
78
  "peerDependencies": {
79
- "@cornerstonejs/core": "5.8.2"
79
+ "@cornerstonejs/core": "5.10.2"
80
80
  },
81
81
  "contributors": [
82
82
  {
@@ -88,6 +88,5 @@
88
88
  "funding": {
89
89
  "type": "individual",
90
90
  "url": "https://ohif.org/donate"
91
- },
92
- "gitHead": "7034957b10f5e91ad8f4d7978591ef688e262d26"
91
+ }
93
92
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 Open Health Imaging Foundation
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.