nnUNet icon indicating copy to clipboard operation
nnUNet copied to clipboard

Converting Tiff to Nifti

Open dsitnik opened this issue 3 years ago • 4 comments

Hi,

I am trying to convert tiff images into the required nifti format using the following function:

https://github.com/MIC-DKFZ/nnUNet/blob/06505439d5e3239105c867c6b380a95f44090431/nnunet/utilities/file_conversions.py#L63

What exactly is "spacing"? There is no explanation in the functions' description.

----> file_conversions.convert_3d_tiff_to_nifti(path+"imagesTs/"+name,"./"+out_name) TypeError: convert_3d_tiff_to_nifti() missing 1 required positional argument: 'spacing'

Do you have a working example?

dsitnik avatar Aug 30 '21 07:08 dsitnik

I think it refers to the Image Pixel Spacing. It is the distance between the centers of the adjacent pixels. For eg: It could be [1.0, 1.0, 1.5].

sainatarajan avatar Aug 30 '21 14:08 sainatarajan

thanks @sainatarajan . Yes it refers to the pixel resolution. If your images don't have a resolution you can set this to (1, 1, 1)

FabianIsensee avatar Sep 01 '21 06:09 FabianIsensee

I ran into the same problem when preprocessing the LiTS dataset.

nileshkumar0726 avatar Oct 07 '22 17:10 nileshkumar0726

Hello,

Did you manage to resolve the problem or do you need further assistance? Otherwise, I will close the issue as its quite dated.

Cheers Ole

dojoh avatar Aug 02 '23 12:08 dojoh