Пример #1
0
def get_global_static_projection_delay(): 
    """Get the global static projection (i.e. no time binning). """
    info = get_global_static_projection_info_delay() 
    N_locations = info['N_locations']
    N_axial     = info['N_axial']
    N_azimuthal = info['N_azimuthal']
    descriptor = [  {'name':'time_start',              'type':'uint',      'value':None           }, 
                    {'name':'time_end',                'type':'uint',      'value':None           }, 
                    {'name':'N_counts',                'type':'uint',      'value':None           }, 
                    {'name':'N_locations',             'type':'uint',      'value':None           }, 
                    {'name':'compression_ratio',       'type':'float',     'value':None           },
                    {'name':'listmode_loss',           'type':'float',     'value':None           },
                    {'name':'N_axial',                 'type':'uint',      'value':None           }, 
                    {'name':'N_azimuthal',             'type':'uint',      'value':None           }, 
                    {'name':'angles_axial',            'type':'float',     'value':None,    'dtype':float32,   'size':(1,N_axial) }, 
                    {'name':'angles_azimuthal',        'type':'float',     'value':None,    'dtype':float32,   'size':(1,N_azimuthal) }, 
                    {'name':'size_u',                  'type':'float',     'value':None           }, 
                    {'name':'size_v',                  'type':'float',     'value':None           }, 
                    {'name':'N_u',                     'type':'uint',      'value':None           }, 
                    {'name':'N_v',                     'type':'uint',      'value':None           },  
                    {'name':'offsets',                 'type':'array',     'value':None,   'dtype':int32,  'size':(N_azimuthal,N_axial), 'order':'F'}, 
                    {'name':'counts',                  'type':'array',     'value':None,   'dtype':float32, 'size':(N_locations),        'order':'F'}, 
                    {'name':'locations',               'type':'array',     'value':None,   'dtype':uint16,  'size':(3,N_locations),      'order':'F'},             ] 
    r = call_c_function( mMR_c.get_global_static_projection_delay, descriptor )
    if not r.status == petlink.status_success(): 
        raise ErrorInCFunction("The execution of 'get_global_static_projection_delay' was unsuccessful.",r.status,'mMR_c.get_global_static_projection_delay')
    return r.dictionary 
Пример #2
0
def petlink32_to_dynamic_projection_cyclic_mMR(filename, n_packets, n_radial_bins,n_angles,n_sinograms,time_bins,n_axial,n_azimuthal,angles_axial,angles_azimuthal,size_u,size_v,n_u,n_v,span,n_segments,segments_sizes,michelogram_segments,michelogram_planes, status_callback): 
    """Make dynamic compressed projection from list-mode data - cyclic. """
    descriptor = [  {'name':'filename',               'type':'string',  'value':filename ,'size':len(filename)},
                    {'name':'n_packets',              'type':'long',    'value':n_packets                }, 
                    {'name':'n_radial_bins',          'type':'uint',    'value':n_radial_bins            }, 
                    {'name':'n_angles',               'type':'uint',    'value':n_angles                 },
                    {'name':'n_sinograms',            'type':'uint',    'value':n_sinograms              },
                    
                    {'name':'n_frames',               'type':'uint',    'value':time_bins.shape[0]       },
                    {'name':'n_repetitions',          'type':'uint',    'value':time_bins.shape[1]       },
                    {'name':'time_bins',              'type':'array',   'value':int32(time_bins)         }, 
                                                           
                    {'name':'n_axial',                'type':'uint',    'value':n_axial                  },
                    {'name':'n_azimuthal',            'type':'uint',    'value':n_azimuthal              },
                    {'name':'angles_axial',           'type':'array',   'value':angles_axial             },
                    {'name':'angles_azimuthal',       'type':'array',   'value':angles_azimuthal         },
                    {'name':'size_u',                 'type':'float',   'value':size_u                   },
                    {'name':'size_v',                 'type':'float',   'value':size_v                   },
                    {'name':'n_u',                    'type':'uint',    'value':n_u                      },
                    {'name':'n_v',                    'type':'uint',    'value':n_v                      }, 
                    {'name':'span',                   'type':'uint',    'value':span                     }, 
                    {'name':'n_segments',             'type':'uint',    'value':n_segments               }, 
                    {'name':'segments_sizes',         'type':'array',   'value':int32(segments_sizes)    }, 
                    {'name':'michelogram_segments',   'type':'array',   'value':int32(michelogram_segments) }, 
                    {'name':'michelogram_planes',     'type':'array',   'value':int32(michelogram_planes)   }, 
                    {'name':'status_callback',        'type':'function','value':status_callback,  'arg_types':['uint']     },   ]
    r = call_c_function( mMR_c.petlink32_to_dynamic_projection_cyclic_mMR_michelogram, descriptor ) 
    if not r.status == petlink.status_success(): 
        raise ErrorInCFunction("The execution of 'petlink32_to_dynamic_projection_cyclic_mMR_michelogram' was unsuccessful.",r.status,'mMR_c.petlink32_to_dynamic_projection_cyclic_mMR')
    return r.dictionary 
Пример #3
0
def get_static_projection_prompt(time_bin): 
     """Get the static projection corresponding to a given time bin of the current dynamic projection data. """
     info = get_static_projection_info_prompt(time_bin) 
     N_locations = info['N_locations']
     N_axial     = info['N_axial']
     N_azimuthal = info['N_azimuthal']
     descriptor = [  {'name':'time_bin',                'type':'uint',      'value':time_bin       }, 
                     {'name':'time_start',              'type':'uint',      'value':None           }, 
                     {'name':'time_end',                'type':'uint',      'value':None           }, 
                     {'name':'N_counts',                'type':'uint',      'value':None           }, 
                     {'name':'N_locations',             'type':'uint',      'value':None           }, 
                     {'name':'compression_ratio',       'type':'float',     'value':None           },
                     {'name':'listmode_loss',           'type':'float',     'value':None           },
                     {'name':'N_axial',                 'type':'uint',      'value':None           }, 
                     {'name':'N_azimuthal',             'type':'uint',      'value':None           }, 
                     {'name':'angles_axial',            'type':'float',     'value':None,    'dtype':float32,   'size':(1,10000) }, 
                     {'name':'angles_azimuthal',        'type':'float',     'value':None,    'dtype':float32,   'size':(1,10000) },  
                     {'name':'size_u',                  'type':'float',     'value':None           }, 
                     {'name':'size_v',                  'type':'float',     'value':None           }, 
                     {'name':'N_u',                     'type':'uint',      'value':None           }, 
                     {'name':'N_v',                     'type':'uint',      'value':None           },  
                     {'name':'offsets',                 'type':'array',     'value':None,   'dtype':int32,  'size':(N_azimuthal,N_axial), 'order':'F'}, 
                     {'name':'counts',                  'type':'array',     'value':None,   'dtype':float32,  'size':(N_locations),       'order':'F'}, 
                     {'name':'locations',               'type':'array',     'value':None,   'dtype':uint16,  'size':(3,N_locations),      'order':'F'},             ] 
     r = call_c_function( mMR_c.get_static_projection_prompt, descriptor )
     if not r.status == petlink.status_success(): 
         raise ErrorInCFunction("The execution of 'get_static_projection_prompt' was unsuccessful.",r.status,'mMR_c.get_static_projection_prompt')
     return r.dictionary 
Пример #4
0
def get_gates(): 
     info = get_gates_info()
     N = info['N'] 
     descriptor = [  {'name':'N',                     'type':'uint',      'value':N              }, 
                     {'name':'type',                  'type':'array',     'value':None,   'dtype':int32,  'size':(N),       'order':'F'}, 
                     {'name':'time',                  'type':'array',     'value':None,   'dtype':int32,  'size':(N),       'order':'F'}, 
                     {'name':'payload',               'type':'array',     'value':None,   'dtype':int32,  'size':(N),       'order':'F'}  ]
     r = call_c_function( mMR_c.get_gates, descriptor )
     if not r.status == petlink.status_success(): 
         raise ErrorInCFunction("The execution of 'get_gates' was unsuccessful.",r.status,'mMR_c.get_gates')
     return r.dictionary 
Пример #5
0
def petline32_load_gates(filename, n_packets, time_bins, status_callback):
    time_bins = int32(time_bins)
    descriptor = [  {'name':'filename',               'type':'string',  'value':filename ,'size':len(filename)},
                    {'name':'n_packets',              'type':'long',    'value':n_packets                }, 
                    {'name':'use_time_bins',          'type':'uint',    'value':len(time_bins)           }, 
                    {'name':'time_bins',              'type':'array',   'value':time_bins                },                                        
                    {'name':'status_callback',        'type':'function','value':status_callback,  'arg_types':['uint']     },   ]
    r = call_c_function( mMR_c.petlink32_load_gates, descriptor ) 
    if not r.status == petlink.status_success(): 
        raise ErrorInCFunction("The execution of 'petlink32_load_gates' was unsuccessful.",r.status,'mMR_c.petlink32_load_gates')
    return r.dictionary 
Пример #6
0
def get_dynamic_projection_info_delay(): 
    """Get information about the current dynamic projection data. """
    descriptor = [   {'name':'N_time_bins',             'type':'uint',      'value':None       }, 
                     {'name':'N_counts',                'type':'long',      'value':None       }, 
                     {'name':'N_locations',             'type':'uint',      'value':None       }, 
                     {'name':'compression_ratio',       'type':'float',     'value':None       }, 
                     {'name':'dynamic_inflation',       'type':'float',     'value':None       }, 
                     {'name':'listmode_loss',           'type':'float',     'value':None       }, 
                     {'name':'time_start',              'type':'uint',      'value':None       },   
                     {'name':'time_end',                'type':'uint',      'value':None       },   ]                 
    r = call_c_function( mMR_c.get_dynamic_projection_info_delay, descriptor )
    if not r.status == petlink.status_success(): 
        raise ErrorInCFunction("The execution of 'get_dynamic_projection_info_delay' was unsuccessful.",r.status,'mMR_c.get_dynamic_projection_info_delay')
    return r.dictionary 
Пример #7
0
def get_gates_info(): 
    descriptor = [   {'name':'N_gating1',             'type':'uint',      'value':None       }, 
                     {'name':'N_gating2',             'type':'uint',      'value':None       }, 
                     {'name':'N_gating3',             'type':'uint',      'value':None       }, 
                     {'name':'N_gating4',             'type':'uint',      'value':None       }, 
                     {'name':'N_gating5',             'type':'uint',      'value':None       }, 
                     {'name':'N_gating6',             'type':'uint',      'value':None       }, 
                     {'name':'N_gating7',             'type':'uint',      'value':None       }, 
                     {'name':'N',                     'type':'uint',      'value':None       }, 
                     {'name':'time_start',            'type':'uint',      'value':None       },   
                     {'name':'time_end',              'type':'uint',      'value':None       },   ]                 
    r = call_c_function( mMR_c.get_gates_info, descriptor )
    if not r.status == petlink.status_success(): 
        raise ErrorInCFunction("The execution of 'get_gates_info' was unsuccessful.",r.status,'mMR_c.get_gates_info')
    return r.dictionary 
Пример #8
0
def get_global_static_projection_info_delay(): 
    """Get information about a time bin of the current dynamic projection data. """
    descriptor = [  {'name':'time_start',              'type':'uint',      'value':None           }, 
                    {'name':'time_end',                'type':'uint',      'value':None           }, 
                    {'name':'N_counts',                'type':'uint',      'value':None           }, 
                    {'name':'N_locations',             'type':'uint',      'value':None           }, 
                    {'name':'compression_ratio',       'type':'float',     'value':None           },
                    {'name':'listmode_loss',           'type':'float',     'value':None           },
                    {'name':'N_axial',                 'type':'uint',      'value':None           }, 
                    {'name':'N_azimuthal',             'type':'uint',      'value':None           }, 
                    {'name':'angles_axial',            'type':'float',     'value':None,    'dtype':float32,   'size':(1,10000), 'order':'F' }, 
                    {'name':'angles_azimuthal',        'type':'float',     'value':None,    'dtype':float32,   'size':(1,10000), 'order':'F' },  
                    {'name':'size_u',                  'type':'float',     'value':None           }, 
                    {'name':'size_v',                  'type':'float',     'value':None           }, 
                    {'name':'N_u',                     'type':'uint',      'value':None           }, 
                    {'name':'N_v',                     'type':'uint',      'value':None           },  ] 
    r = call_c_function( mMR_c.get_global_static_projection_info_delay, descriptor )
    if not r.status == petlink.status_success(): 
        raise ErrorInCFunction("The execution of 'get_global_static_projection_info_delay' was unsuccessful.",r.status,'mMR_c.get_global_static_projection_info_delay')
    return r.dictionary 
Пример #9
0
def free_memory(): 
    """Free memory""" 
    r = call_c_function( mMR_c.free_memory, [] )
    if not r.status == petlink.status_success(): 
        raise ErrorInCFunction("The execution of 'free_memory' was unsuccessful.",r.status,'mMR_c.free_memory')
    return r.dictionary