Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dicomImageLoader): make cornerstone to use new dicom image loade…
…r and handle scaling correctly (#553) * rename old example for now * rename old example for now * make examples work with dicom image loader * make dicom image loader everywhere * fix examples * fix examples * wip * update package json * try to fix build preview * types * refactor: Simplify code & improve accessibility in dicomImageLoaderWADOURI example * Moved image selection buttons to a dropdown menu for better accessibility. * Removed unnecessary code from loadAndViewImage function in index.ts file. * wip * work with float32 explicit for all * colors should use uint8Array * fix scaling issue for rescale slope and intercept * fix the 8 bit float scaling params * fix cpu rendering when convertFloatPixelDataToInt is set to true * work for volume SAB and non SAB and stack GPU * cpu pipeline work for all including float * update build * after rebase * remove unnecessary code * remove unnecessary code * fix(rendering): Upgrade vtk.js and update rendering pipeline The vtk.js version has been upgraded to 27.2.0, and the rendering pipeline has been updated as well. `use16BitTexture` has been replaced with `useNativeDataType` to support additional configuration flags. `updateRenderingPipeline` has been implemented in `StackViewport` and `Viewport` for updates to the rendering pipeline. `setPreferSizeOverAccuracy` and `setUseCPURendering` have been added to `cornerstone.js`. The demo has been updated with buttons to toggle CPU rendering and size versus accuracy options. * refactor(imageLoader): move isColorImage to shared directory This commit moves the isColorImage function from the imageLoader directory to the shared directory to be used across the dicomImageLoader package. It also updates the imports of isColorImage throughout the dicomImageLoader package. The isColorImage function checks whether the image is a color image or not based on the photometric interpretation. The commit also updates the createImage and decodeImageFrame functions to use the isColorImage function and render color image in 8-bit in case of rendering issues. * feat(rendering): optimize pixel data handling for vtkImageData and other rendering libraries This commit replaces the "typedArray" property of "StackViewport" with the "pixelArray" property to avoid confusion with TypedArray. We also ensure that the rendering library vtkImageData receives an optimized Uint8Array format for RGB images. Other changes include renaming "getTypedArrayFromMinMax" to "getPixelDataTypeFromMinMax" and returning the pixel data type instead of the TypedArray constructor for better semantic representation. We also ensure that the new function uses the correct numeric range for the different TypedArrays. Finally, in "createImage" and "decodeImageFrame" we apply these changes to improve the performance of rendering with image libraries. * feat(StackViewport): add processing for color images on CPU fallback This commit adds handling for color images in vtkImageData obtained through CPU fallback rendering. Images' pixel data was previously loaded as RGBA, so color images were left with the A channel still present, causing problems in some rendering processes. This commit's code processes the pixel data to remove the A channel for color images specifically. Related files have also been updated. * update api * refactor * feat(renderer): add support for RGBA and disable the use of an extra pixel array Refactor the StackViewport renderer code to add support for RGBA images and uses scalars to update the vtkImageData object that eliminates the need of an extra pixel array to be used. LoadImageToCanvas utility updated to support the use of RGBA. * wip working cpu and gpu rgb little endian * feat(dicomImageLoader): Added support for RGB and 8 bits color image types This commit adds support for RGB and 8 bits color image types while decoding the image data. The commit also updates the code to convert the pixel data to rgba if decoding is done as RGB. The new code also takes alpha values into account when adding them to the pixel data. * yarn lock * upgrade vtk * update api * feat(imageLoader): add clean build option to webpack configs The webpack configuration files have been updated to add the clean option for cleaning the output directory before building. This will ensure a clean build and avoid any potential conflicts with previous builds. Additionally, the createImage function in imageLoader has been refactored to use a constant for the useRGBA option instead of conditional statements. Finally, the createImageIdsAndCacheMetaData function has been updated to use SOPInstanceUID or fallback to the value at SOP_INSTANCE_UID. * fix typo * try to build * update api * add review comments
- Loading branch information