-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rendering): should still use Float32 when not 16 bit for scaling …
…issues (#501)
- Loading branch information
Showing
13 changed files
with
91 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ import eventTarget from '../eventTarget'; | |
import triggerEvent from '../utilities/triggerEvent'; | ||
import { uuidv4 } from '../utilities'; | ||
import { Point3, Metadata, EventTypes, Mat3 } from '../types'; | ||
import { getConfiguration } from '../init'; | ||
|
||
interface VolumeLoaderOptions { | ||
imageIds: Array<string>; | ||
|
@@ -273,6 +274,8 @@ export async function createAndCacheDerivedVolume( | |
|
||
let numBytes, TypedArray; | ||
|
||
const { useNorm16Texture } = getConfiguration().rendering; | ||
|
||
// If target buffer is provided | ||
if (targetBuffer) { | ||
if (targetBuffer.type === 'Float32Array') { | ||
|
@@ -281,10 +284,10 @@ export async function createAndCacheDerivedVolume( | |
} else if (targetBuffer.type === 'Uint8Array') { | ||
numBytes = scalarLength; | ||
TypedArray = Uint8Array; | ||
} else if (targetBuffer.type === 'Uint16Array') { | ||
} else if (useNorm16Texture && targetBuffer.type === 'Uint16Array') { | ||
numBytes = scalarLength * 2; | ||
TypedArray = Uint16Array; | ||
} else if (targetBuffer.type === 'Int16Array') { | ||
} else if (useNorm16Texture && targetBuffer.type === 'Int16Array') { | ||
This comment has been minimized.
Sorry, something went wrong.
Ouwen
Contributor
|
||
numBytes = scalarLength * 2; | ||
TypedArray = Uint16Array; | ||
} else { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import * as metaData from '../metaData'; | |
import { RequestType } from '../enums'; | ||
import imageLoadPoolManager from '../requestPool/imageLoadPoolManager'; | ||
import renderToCanvas from './renderToCanvas'; | ||
import { getConfiguration } from '../init'; | ||
|
||
/** | ||
* Loads and renders an imageId to a Canvas. It will use the CPU rendering pipeline | ||
|
@@ -55,9 +56,14 @@ export default function loadImageToCanvas( | |
); | ||
} | ||
|
||
const { useNorm16Texture } = getConfiguration().rendering; | ||
|
||
// IMPORTANT: Request type should be passed if not the 'interaction' | ||
// highest priority will be used for the request type in the imageRetrievalPool | ||
const options = { | ||
targetBuffer: { | ||
type: useNorm16Texture ? undefined : 'Float32Array', | ||
}, | ||
This comment has been minimized.
Sorry, something went wrong.
Ouwen
Contributor
|
||
preScale: { | ||
enabled: true, | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ import { | |
eventTarget, | ||
imageLoadPoolManager, | ||
cache, | ||
Types, | ||
getConfiguration as getCoreConfiguration, | ||
} from '@cornerstonejs/core'; | ||
import { addToolState, getToolState } from './state'; | ||
|
||
|
@@ -243,10 +243,15 @@ function prefetch(element) { | |
const requestFn = (imageId, options) => | ||
imageLoader.loadAndCacheImage(imageId, options); | ||
|
||
const { useNorm16Texture } = getCoreConfiguration().rendering; | ||
|
||
imageIdsToPrefetch.forEach((imageId) => { | ||
// IMPORTANT: Request type should be passed if not the 'interaction' | ||
// highest priority will be used for the request type in the imageRetrievalPool | ||
const options = { | ||
targetBuffer: { | ||
type: useNorm16Texture ? undefined : 'Float32Array', | ||
}, | ||
This comment has been minimized.
Sorry, something went wrong.
Ouwen
Contributor
|
||
preScale: { | ||
enabled: true, | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@sedghi this will probably need to be changed to
Otherwise an error will get thrown due to CSWIL calling undefined an invalid type