In the case of pulmonary nodule detection, the size varies after the Dicom file reshape is encountered. Because of the big, numpy.reshape can not be reshaped to a specified size. Finally, a solution was found in the code of a Daniel.
VL = np.load (R ' D:\pycharm\TEAMWORK\Preprocess_3D\imageOR.npy ')
# in my imageor, every file except for the 3-dimensional ndarray, which also holds the tag lab, is written in isometric_volume[0], so if you only have the array information, simply remove the following [0]
votal = []
For Isometric_volume in VL:
print (isometric_volume[0], ' first ')
mean = Np.mean (isometric_volume[0]). Astype (Np.float32)
std = np.std (isometric_volume[0]). Astype (Np.float32)
volume_resized = Scipy.ndimage.interpolation.zoom (isometric_volume[0],
np.divide (isometric_volume[0].shape),
mode= ' nearest ')
volume_resized = (Volume_resized.astype (np.float32)-mean)/(Std + 1e-7)
z0, z1 = VOLUME_RESIZED.SHAPE[0]//2, volume_resized.shape[0]
y0, y1 = 0, Volume_resized.shape[1]//2
volume_resized = Volume_resized[z0:z1, y0:y1,:]
Votal.append ([volume_resized, Isometric_volume[1]])
print (volume_resized, ' volume_resized ')
print (Volume_resized.shape)
print (votal, ' votal ')
np.save (' Newimage.npy ', votal)
How the Ndarray array of numpy reshape into a fixed size