Closed TheInfamousWayne closed 3 years ago
You will have to point the function to the header file, rather than the image file (The image file alone does not contain any information of how to handle the included data). The reader then automatically determines the location and name of the image file (I think, by convention, they are to be named something.hdr and something.img).
I'm trying to lead the image (.img file) and its header (.img.hdr) file using medpy.io load function. It says in the documentation that it supports such file types. However, everytime I do
data,header = load("/path/to/file.img")
, I get the following error:RuntimeError: Exception thrown in SimpleITK ImageFileReader_Execute: /Users/runner/work/1/sitk/Code/IO/src/sitkImageReaderBase.cxx:105: sitk::ERROR: Unable to determine ImageIO reader for "/Volumes/ERC/Data/ERC-15-PyVmT-FDG/Frozen CT/MaKr-ERC-13-15-CT-007-Frozen_XST_FullRotation220steps_127mm_v1.ct.img"
The alternate solution I have is to open the ".img" file using open() python function for file opening and then reshaping the data according to the manually read information from the header.
Any leads here?