title: Problems with converting all slices into nii.gz at once
body: <p>I'm using the following code to convert all my 332 npy slices into the nii.gz format:</p>
  <pre><code>import numpy as np
  import nibabel as nib
  
  file_dir = &quot;D:/Volumes convertidos LIDC/&quot;
  fileNPY1 = &quot;slice200.npy&quot;
  img_array1 = np.load(file_dir + fileNPY1) 
  nifti_file = nib.Nifti1Image(img_array1 , np.eye(4))
  nib.save(nifti_file, &quot;D:/slices convertidos/slice200converted.nii.gz&quot;)
  </code></pre>
  <p><strong>There are just too many slices for me (and tons of images) to keep doing it that way, is there a way to convert them all at once?</strong></p>