I have a .nii image of size 30, 28, 256, 256. I want to reshape it to 256, 256, 28, 30. I tried converting to numpy array and then using sitk.GetImageFromArray(). However, the size of the resulting image is 256, 256, 28. The fourth dimension is lost.
Also keep in mind that the index order of a numpy array and a SimpleITK image are opposite, so mixing the two with out clear boundaries ( like functions ) is error prone.
Please read the documentation@blowekamp pointed to. That is a class, you create an instance and call the class methods as you do in regular Python programming.