Closed elephanttt closed 3 years ago
Hello, thank you for your interest in our method !
If you want to convert NifTI images to jpg or png ones, you can use c2d : https://sourceforge.net/p/c3d/git/ci/master/tree/doc/c3d.md
The command should look like : $Path_to_c2d_executable Your_image.nii -o Your_image.png
Let me know if it helps, Best, Ludovic Venet.
As an added note, c2d
is present in the ${install_dir}/bin
once you complete the make install/strip
step.
I wrote a simple piece of python code to convert the NifTI images to jpg ones. It is strange that full_resolution RGB registeredImage.jpg was not being converted correctly(an all white image was generated), nevertheless full_resolution new_source.jpg and new_target.jpg were converted correctly. This is my code.
import nibabel as nib
import numpy as np
from PIL import Image
fn = nib.load('E:/output/CD68_registered_to_CD4/Saved_NIFTIs/full_resolution/registeredImage.nii.gz')
img = fn.get_fdata().astype(np.float32).squeeze()
img[:,:,0]=255-np.uint8(255*img[:,:,0])
img[:,:,1]=255-np.uint8(255*img[:,:,1])
img[:,:,2]=255-np.uint8(255*img[:,:,2])
a = Image.fromarray(np.uint8(img))
a.save('E:/output/CD68_registered_to_CD4/Saved_NIFTIs/full_resolution/registeredImage.jpg')
what is the problem with that?
when I use c2d command, errors happen like that
"ITK Exception:
itk::ExceptionObject (0000001F0935D400)
Location: "void __cdecl itk::PNGImageIO::WriteSlice(const class std::basic_string<char,struct std::char_traits
Unknown exception caught by convert3d" Can you give me a hand?
Hi @elephanttt, did you fix this?
I have installed the HistoReg correctly. but run the example that perform registration from CD68.jpg to CD4.jpg with the command line
${installDir}/bin/HistoReg -m ${HistoReg_source}/Data/Images/CD68.jpg -f ${HistoReg_source}/Data/Images/CD4.jpg -o ${HistoReg_source}/Data/Output/ -F --PNG
, the output registrated image with .png format is a still a gray-scale image that shows nothing.
I think if convert the R/G/B (three channels) image to gray-scale image before registration, the output R/G/B registered image can't be obtained theoretically. The rgb2gray operation is not a one-to-one mapping. Its unique inverse function doesn't exist. (It has multiple inverse functions)
Pinging @ludovenet
I encountered pathology images in NIfTI format for the first time, How can I convert it to the jpg or png format for further processing?