Exemple #1
0
 def resample(self,
              inputs,
              sample_coords,
              interpolation='linear',
              boundary='constant',
              constant_values=0):
     assert interpolation == 'linear'
     return general_grid_sample_nd(inputs, sample_coords, boundary,
                                   constant_values, self)
Exemple #2
0
 def general_sample_at(self, points, reduce):
     local_points = self.box.global_to_local(points)
     local_points = math.mul(local_points, math.to_float(
         self.resolution)) - 0.5
     result = general_grid_sample_nd(
         self.data,
         local_points,
         boundary=_pad_mode(self.extrapolation),
         constant_values=_pad_value(self.extrapolation_value),
         math=math.choose_backend([self.data, points]),
         reduce=reduce)
     return result
Exemple #3
0
 def resample(self,
              inputs,
              sample_coords,
              interpolation='linear',
              boundary='constant',
              constant_values=0):
     assert interpolation == 'linear'
     if use_cuda(inputs):
         return resample_cuda(inputs, sample_coords, boundary)
     else:
         return general_grid_sample_nd(
             inputs, sample_coords, boundary, constant_values, self
         )  # while this is a bit slower than niftynet, it give consisten results at the boundaries