Created
June 3, 2021 07:25
-
-
Save wassname/2a9bd840771e23897dc6b6105793edd6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # load mask | |
| maskp = '../data/raw/NBIA/ProstateX/PROSTATEx_masks/Files/lesions/Masks/For_dcm2niix_files/ADC/\ | |
| ProstateX-0142-Finding3-ep2d_diff_tra_DYNDIST_ADC0_ROI.nii.gz' | |
| y = nib.load(ypath).get_fdata() | |
| # 1. reverse what nii2dcm did | |
| y = y.transpose((1, 0, 2))[::-1, :, ::-1] | |
| # load dicom | |
| dcmp = '../data/raw/NBIA/ProstateX/dicom/train/downloads/PROSTATEx/ProstateX-0142/\ | |
| 1.3.6.1.4.1.14519.5.2.1.7311.5101.996427223934342627726053270358/03-01-2012/\ | |
| 1.3.6.1.4.1.14519.5.2.1.7311.5101.306670854887133177188202025871/\ | |
| 1.3.6.1.4.1.14519.5.2.1.7311.5101.745508277200433890424532732507.dcm' | |
| dcm = pydicom.dcmread(dcmp) | |
| x2 = dcm.pixel_array | |
| plt.imshow(x2) | |
| # show mask, hide the 0's | |
| z_index = int(dcm.InstanceNumber) | |
| ym = np.ma.masked_less_equal(y, 0) | |
| plt.imshow(ym[:, :, z_index], cmap='Paired', vmin=-1, vmax=2) | |
| plt.axis('off') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment