~brenthuisman/medimage

8b3fccd6a6edc19418ff261c2f3520e819f931ce — Brent 9 months ago 3148928
dicom read: use GridFrameOffsetVector if available
1 files changed, 7 insertions(+), 6 deletions(-)

M medimage/io_dicom.py
M medimage/io_dicom.py => medimage/io_dicom.py +7 -6
@@ 49,12 49,13 @@ def read(self,filename,**kwargs):
			#[dcm.SliceThickness]+list(dcm.PixelSpacing[::-1])
		except:
			self.header['ElementSpacing'] = [float(dcm.PixelSpacing[0]), float(dcm.PixelSpacing[1])]

		try:
			a=np.diff(dcm.GridFrameOffsetVector)
			print(a)
		except:
			pass
			try:
				a=np.diff(dcm.GridFrameOffsetVector)
				b=np.unique(a)
				if len(b) == 1:
					self.header['ElementSpacing'].append(float(b))
			except:
				raise IOError("Nonlinear image opend: I don't handle this yet!")

		try:
			self.mul(dcm.DoseGridScaling) #doses may have this