def set_coil_sensitivity_maps(self, csm): ''' Specifies the coil sensitivity maps to be used by the model. csm: CoilSensitivityData ''' assert_validity(csm, CoilSensitivityData) try_calling(pygadgetron.cGT_setAcquisitionModelParameter \ (self.handle, 'coil_sensitivity_maps', csm.handle))
def calculate(self, acqs): ''' Calculates coil images from a given sorted acquisitions. acqs: AcquisitionData ''' assert_validity(acqs, AcquisitionData) if acqs.is_sorted() is False: print('WARNING: acquisitions may be in a wrong order') try_calling(pygadgetron.cGT_computeCoilImages\ (self.handle, acqs.handle))
def __init__(self, acqs=None, imgs=None): self.handle = None if acqs == None: self.handle = pygadgetron.cGT_newObject('AcquisitionModel') else: assert_validity(acqs, AcquisitionData) assert_validity(imgs, ImageData) self.handle = \ pygadgetron.cGT_AcquisitionModel(acqs.handle, imgs.handle) check_status(self.handle)
def backward(self, ad): ''' Back-projects acquisition data into image space using a complex transpose of the forward projection. ad: AcquisitionData ''' assert_validity(ad, AcquisitionData) image = ImageData() image.handle = pygadgetron.cGT_AcquisitionModelBackward\ (self.handle, ad.handle) check_status(image.handle) return image
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 forward(self, image): ''' Projects an image into (simulated) acquisitions space. The resulting acquisition data simulates the actual data expected to be received from the scanner. image: ImageData ''' assert_validity(image, ImageData) ad = AcquisitionData() ad.handle = pygadgetron.cGT_AcquisitionModelForward\ (self.handle, image.handle) check_status(ad.handle) return ad
def reconstruct(self, input_data): ''' Returns the output from the chain for specified input. input_data: AcquisitionData ''' assert_validity(input_data, AcquisitionData) handle = pygadgetron.cGT_reconstructImages\ (self.handle, input_data.handle) check_status(handle) pyiutil.deleteDataHandle(handle) images = ImageData() images.handle = pygadgetron.cGT_reconstructedImages(self.handle) check_status(images.handle) return images
def process(self, input_data=None): ''' Returns the output from the chain for specified input. input_data: AcquisitionData ''' if input_data is not None: self.set_input(input_data) if self.input_data is None: raise error('input data not set') assert_validity(self.input_data, AcquisitionData) acquisitions = AcquisitionData() acquisitions.handle = pygadgetron.cGT_processAcquisitions\ (self.handle, self.input_data.handle) check_status(acquisitions.handle) self.output_data = acquisitions return acquisitions
def process(self, input_data=None): ''' Returns the output from the chain. input_data: ImageData ''' if input_data is not None: self.set_input(input_data) if self.input_data is None: raise error('input data not set') assert_validity(self.input_data, ImageData) image = ImageData() image.handle = pygadgetron.cGT_processImages\ (self.handle, self.input_data.handle) check_status(image.handle) self.output_data = image return image
def set_up(self, acqs, imgs): assert_validity(acqs, AcquisitionData) assert_validity(imgs, ImageData) try_calling(pygadgetron.cGT_setUpAcquisitionModel \ (self.handle, acqs.handle, imgs.handle))