示例#1
0
文件: sino.py 项目: tech-pi/SRF
 def bind_local_sino(self, task_index=None):
     if task_index is None:
         task_index = ThisHost.host().task_index
     if ThisHost.is_master():
         logger.info("On Master node, skip bind local sino.")
         return
     else:
         logger.info(
             "On Worker node, local data for worker {}.".format(task_index))
         worker_sinos = self.load_local_sino(task_index)
         self.worker_graphs[task_index].init_sino(worker_sinos)
示例#2
0
文件: osem.py 项目: tech-pi/SRF
 def bind_local_data(self, data_info, task_index=None):
     if task_index is None:
         task_index = ThisHost.host().task_index
     if ThisHost.is_master():
         logger.info("On Master node, skip bind local data.")
         return
     else:
         logger.info(
             "On Worker node, local data for worker {}.".format(task_index))
         emap, lors = self.load_local_data(data_info, task_index)
         self.worker_graphs[task_index].assign_efficiency_map(emap)
         self.worker_graphs[task_index].assign_lors(lors)
示例#3
0
文件: sino.py 项目: tech-pi/SRF
 def bind_local_matrix(self, task_index=None):
     if task_index is None:
         task_index = ThisHost.host().task_index
     if ThisHost.is_master():
         logger.info("On Master node, skip bind local matrix.")
         return
     else:
         logger.info(
             "On Worker node, local data for worker {}.".format(task_index))
         worker_matrix = self.load_local_matrix(task_index)
         worker_matrix = sparse.coo_matrix(worker_matrix)
         self.worker_graphs[task_index].init_matrix(worker_matrix)
示例#4
0
文件: sino.py 项目: tech-pi/SRF
 def bind_local_data(self):
     """
     bind the static effmap data
     """
     return
     map_file = self.work_directory + self.image_info.map_file
     #matrix_file = self.work_directory + self.Inputinfo.sm
     task_index = ThisHost.host().task_index
     if ThisHost.is_master():
         logger.info("On Master node, skip bind local data.")
         return
     else:
         logger.info(
             "On Worker node, local data for worker {}.".format(task_index))
         emap = self.load_local_effmap(map_file)
         self.worker_graphs[task_index].init_efficiency_map(emap)
     self.bind_local_sino()
     self.bind_local_matrix()
示例#5
0
文件: osem.py 项目: tech-pi/SRF
 def run_and_save_if_is_master(self, x, path):
     if ThisHost.is_master():
         if isinstance(x, Tensor):
             x = x.data
         result = ThisSession.run(x)
         np.save(path, result)
示例#6
0
文件: sino.py 项目: tech-pi/SRF
 def run_and_print_if_is_master(self, x):
     if ThisHost.is_master():
         if isinstance(x, Tensor):
             x = x.data
         result = ThisSession.run(x)
         print(result)