You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am using NIFTI format CT data for segmentation, but the segmentation results don't seem to be satisfactory. The data was converted from JPG format images using 3D Slicer. I am not sure if this is the reason for the poor segmentation results. Could you please provide some guidance?
The text was updated successfully, but these errors were encountered:
Hello @Li-999-qw, if your original data was in the format of JPG files definetely there could be some problems. Something very important when applying these models is the dynamic range of the images, in this case the author of this repo asks for the images to be in their original dynamic range in HU values (roughly air in the lungs should be -900 HU).
If you want to recover those values from the JPEG images you can try to do so, but usually JPEG images have a depth of 8bit in B&W format (meaning you can only represent 256 numbers) and NiFTI/DICOM images dynamic range can have between 4,096 and 65,536 shades of gray (i.e. values that can be represented in each pixel). So definetely you will loose some information in the process.
To convert to NifTi from JPEG one option could be:
importnumpyasnpimportcv2importnibabelasnib# Replace image.jpeg with the name of your file and rescale to 16-bit rangejpeg_img=cv2.imread('image.jpeg', cv2.IMREAD_GRAYSCALE)
rescaled_img= (jpeg_img/255.0*65535).astype(np.uint16)
# Save as NIfTI assuming the orientation is rightnifti_img=nib.Nifti1Image(rescaled_img, affine=np.eye(4))
nib.save(nifti_img, 'output.nii')
Hello, I am using NIFTI format CT data for segmentation, but the segmentation results don't seem to be satisfactory. The data was converted from JPG format images using 3D Slicer. I am not sure if this is the reason for the poor segmentation results. Could you please provide some guidance?
The text was updated successfully, but these errors were encountered: