def is_complex(self): assert self.handle is not None handle = pysirf.cSIRF_isComplex(self.handle) check_status(handle) i = pyiutil.intDataFromHandle(handle) pyiutil.deleteDataHandle(handle) return i != 0
def __eq__(self, other): """Overload comparison operator.""" if not isinstance(other, NiftiImageData): raise AssertionError() h = pysirfreg.cSIRFReg_NiftiImageData_equal(self.handle, other.handle) check_status(h, inspect.stack()[1]) value = pyiutil.intDataFromHandle(h) pyiutil.deleteDataHandle(h) return value
def __eq__(self, other): """Overload comparison operator.""" if not isinstance(other, AffineTransformation): raise AssertionError() h = pyreg.cReg_AffineTransformation_equal(self.handle, other.handle) check_status(h, inspect.stack()[1]) value = pyiutil.intDataFromHandle(h) pyiutil.deleteDataHandle(h) return value
def get_original_datatype(self): """Get original image datatype (internally everything is converted to float).""" if self.handle is None: raise AssertionError() handle = pyreg.cReg_NiftiImageData_get_original_datatype(self.handle) check_status(handle) datatype = pyiutil.intDataFromHandle(handle) pyiutil.deleteDataHandle(handle) return datatype
def number(self): ''' Returns the number of items in the container. ''' assert self.handle is not None handle = pysirf.cSIRF_dataItems(self.handle) check_status(handle) n = pyiutil.intDataFromHandle(handle) pyiutil.deleteDataHandle(handle) return n
def __eq__(self, other): """Overload comparison operator.""" if not isinstance(other, NiftiImageData): raise AssertionError() if self.handle is None or other.handle is None: error('Cannot compare images as at least one is uninitialised') h = pyreg.cReg_NiftiImageData_equal(self.handle, other.handle) check_status(h, inspect.stack()[1]) value = pyiutil.intDataFromHandle(h) pyiutil.deleteDataHandle(h) return value
def data_type(self, im_num): ''' Returns the data type for a specified image (see 8 data types above). im_num: image (slice) ''' assert self.handle is not None handle = pygadgetron.cGT_imageDataType(self.handle, im_num) check_status(handle) n = pyiutil.intDataFromHandle(handle) pyiutil.deleteDataHandle(handle) return n
def equal(self, other): ''' Overloads == for ImageData. other: ImageData ''' assert_validity(self, ImageData) assert_validity(other, ImageData) handle = pysirf.cSIRF_equalImages(self.handle, other.handle) check_status(handle) same = pyiutil.intDataFromHandle(handle) pyiutil.deleteDataHandle(handle) return same
def _int_par_sirf(handle, set_, par): h = pysirfreg.cSIRFReg_parameter(handle, set_, par) check_status(h, inspect.stack()[1]) value = pyiutil.intDataFromHandle(h) pyiutil.deleteDataHandle(h) return value
def _int_par(handle, set, par): h = pygadgetron.cGT_parameter(handle, set, par) check_status(h) value = pyiutil.intDataFromHandle(h) pyiutil.deleteDataHandle(h) return value