cornerstonejs / cornerstone3D

Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the OHIF Viewer.
https://cornerstonejs.org
MIT License
535 stars 277 forks source link

[Bug] GPU rendering adds padding to MRI images #1199

Open annashahin opened 5 months ago

annashahin commented 5 months ago

Describe the Bug

30 px padding is added to MRI with rotated image orientation, e.g. [-.781092, -.614176, .112619, -.0923705, -.0647223, -.993619]

Steps to Reproduce

displayArea: { imageArea: [1, 1], imageCanvasPoint: { imagePoint: [0.5, 0.5], // imageX, imageY canvasPoint: [0.5, 0.5], // canvasX, canvasY }, storeAsInitialCamera: true, }

Dicom metadata (0002, 0000) File Meta Information Group Length UL: 204 (0002, 0001) File Meta Information Version OB: b'\x00\x01' (0002, 0002) Media Storage SOP Class UID UI: MR Image Storage (0002, 0003) Media Storage SOP Instance UID UI: 1.3.6.1.4.1.14519.5.2.1.187549652730514317814109206348237701923 (0002, 0010) Transfer Syntax UID UI: Implicit VR Little Endian (0002, 0012) Implementation Class UID UI: 1.3.6.1.4.1.22213.1.143 (0002, 0013) Implementation Version Name SH: '0.5' (0002, 0016) Source Application Entity Title AE: 'POSDA'

(0008, 0005) Specific Character Set CS: 'ISO_IR 100' (0008, 0008) Image Type CS: ['ORIGINAL', 'PRIMARY', 'MPR'] (0008, 0016) SOP Class UID UI: MR Image Storage (0008, 0018) SOP Instance UID UI: 1.3.6.1.4.1.14519.5.2.1.187549652730514317814109206348237701923 (0008, 0020) Study Date DA: '19821225' (0008, 0021) Series Date DA: '20070308' (0008, 0023) Content Date DA: '20070308' (0008, 0030) Study Time TM: '171026' (0008, 0031) Series Time TM: '171026' (0008, 0033) Content Time TM: '171026' (0008, 0050) Accession Number SH: '' (0008, 0060) Modality CS: 'MR' (0008, 0070) Manufacturer LO: 'Unknown manufacturer' (0008, 0090) Referring Physician's Name PN: '' (0008, 1030) Study Description LO: 'Preop' (0008, 103e) Series Description LO: '2D_COR_T2_BLADE' (0008, 1090) Manufacturer's Model Name LO: 'Unknown model' (0010, 0010) Patient's Name PN: 'ReMIND-001' (0010, 0020) Patient ID LO: 'ReMIND-001' (0010, 0030) Patient's Birth Date DA: '' (0010, 0040) Patient's Sex CS: '' (0012, 0062) Patient Identity Removed CS: 'YES' (0012, 0063) De-identification Method LO: ['PyDeface-NiftyReg', 'Per DICOM PS 3.15 AnnexE. Details in 0012,0064'] (0012, 0064) De-identification Method Code Sequence 8 item(s) ---- (0008, 0100) Code Value SH: '113100' (0008, 0102) Coding Scheme Designator SH: 'DCM' (0008, 0104) Code Meaning LO: 'Basic Application Confidentiality Profile'

(0008, 0100) Code Value SH: '113101' (0008, 0102) Coding Scheme Designator SH: 'DCM' (0008, 0104) Code Meaning LO: 'Clean Pixel Data Option'

(0008, 0100) Code Value SH: '113104' (0008, 0102) Coding Scheme Designator SH: 'DCM' (0008, 0104) Code Meaning LO: 'Clean Structured Content Option'

(0008, 0100) Code Value SH: '113105' (0008, 0102) Coding Scheme Designator SH: 'DCM' (0008, 0104) Code Meaning LO: 'Clean Descriptors Option'

(0008, 0100) Code Value SH: '113107' (0008, 0102) Coding Scheme Designator SH: 'DCM' (0008, 0104) Code Meaning LO: 'Retain Longitudinal Temporal Information Modified Dates Option'

(0008, 0100) Code Value SH: '113108' (0008, 0102) Coding Scheme Designator SH: 'DCM' (0008, 0104) Code Meaning LO: 'Retain Patient Characteristics Option'

(0008, 0100) Code Value SH: '113109' (0008, 0102) Coding Scheme Designator SH: 'DCM' (0008, 0104) Code Meaning LO: 'Retain Device Identity Option'

(0008, 0100) Code Value SH: '113111' (0008, 0102) Coding Scheme Designator SH: 'DCM' (0008, 0104) Code Meaning LO: 'Retain Safe Private Option'

(0013, 0010) Private Creator LO: 'CTP' (0013, 1010) Private tag data UN: b'ReMIND' (0013, 1013) Private tag data UN: b'36715678' (0018, 0020) Scanning Sequence CS: 'RM' (0018, 0021) Sequence Variant CS: 'NONE' (0018, 0022) Scan Options CS: '' (0018, 0023) MR Acquisition Type CS: '' (0018, 0050) Slice Thickness DS: '2.5' (0018, 0080) Repetition Time DS: None (0018, 0081) Echo Time DS: None (0018, 0088) Spacing Between Slices DS: '1.0' (0018, 0091) Echo Train Length IS: None (0018, 5100) Patient Position CS: 'HFS' (0020, 000d) Study Instance UID UI: 1.3.6.1.4.1.14519.5.2.1.260497661906193334514226770342365856579 (0020, 000e) Series Instance UID UI: 1.3.6.1.4.1.14519.5.2.1.76234098461796570543102404872798323942 (0020, 0010) Study ID SH: '' (0020, 0011) Series Number IS: '1' (0020, 0013) Instance Number IS: '44' (0020, 0032) Image Position (Patient) DS: [68.3206, -26.5412, 68.0363] (0020, 0037) Image Orientation (Patient) DS: [-.781092, -.614176, .112619, -.0923705, -.0647223, -.993619] (0020, 0052) Frame of Reference UID UI: 1.3.6.1.4.1.14519.5.2.1.323887586801415109316746541931780132360 (0020, 0060) Laterality CS: '' (0020, 1040) Position Reference Indicator LO: '' (0028, 0002) Samples per Pixel US: 1 (0028, 0004) Photometric Interpretation CS: 'MONOCHROME2' (0028, 0010) Rows US: 512 (0028, 0011) Columns US: 512 (0028, 0030) Pixel Spacing DS: [.410156249542345, .410156252561044] (0028, 0100) Bits Allocated US: 16 (0028, 0101) Bits Stored US: 16 (0028, 0102) High Bit US: 15 (0028, 0103) Pixel Representation US: 1 (0028, 0303) Longitudinal Temporal Information M CS: 'MODIFIED' (0028, 1050) Window Center DS: '1160.0' (0028, 1051) Window Width DS: '2320.0' (0028, 1054) Rescale Type LO: '' (7fe0, 0010) Pixel Data OW: Array of 524288 elements

The current behavior

30 px padding is added in canvas. dicom_input.zip

The expected behavior

It should be possible to draw dcm file without extra padding & without using zooming tools.

OS

Ubuntu 20, 22, Mac

Node version

16.20

Browser

Chrome 123.0.6312.105, Firefox

sedghi commented 4 months ago

Take a look at resize example you can see how to display without paddings