Beispiel #1
0
 def get(self, landmarks, transformation):
     """
     Return generated heatmaps
     :param landmarks: list of landmarks
     :param transformation: transformation to transform landmarks
     :return: generated heatmaps
     """
     flip = self.is_flipped(transformation)
     preprocessed_landmarks = self.preprocess_landmarks(landmarks, transformation, flip)
     heatmap_image_generator = HeatmapImageGenerator(image_size=self.output_size_np,
                                                     sigma=self.sigma,
                                                     scale_factor=self.scale_factor,
                                                     normalize_center=self.normalize_center)
     heatmaps = heatmap_image_generator.generate_heatmaps(preprocessed_landmarks, self.stack_axis)
     return heatmaps
 def get(self, landmarks, transformation, **kwargs):
     """
     Return generated heatmaps
     :param landmarks: list of landmarks
     :param transformation: transformation to transform landmarks
     :return: generated heatmaps
     """
     output_size = kwargs.get('output_size', self.output_size)
     output_spacing = kwargs.get('output_spacing', self.output_spacing)
     preprocessed_landmarks = self.preprocess_landmarks(landmarks, transformation, output_size, output_spacing)
     heatmap_image_generator = HeatmapImageGenerator(image_size=list(reversed(output_size)),
                                                     sigma=self.sigma,
                                                     scale_factor=self.scale_factor,
                                                     normalize_center=self.normalize_center)
     heatmaps = heatmap_image_generator.generate_heatmaps(preprocessed_landmarks, self.stack_axis, dtype=self.np_pixel_type)
     return heatmaps
Beispiel #3
0
 def get(self, landmarks_multiple, transformation):
     """
     Return generated heatmaps
     :param landmarks_multiple: list of list of landmarks
     :param transformation: transformation to transform landmarks
     :return: generated heatmaps
     """
     flip = self.is_flipped(transformation)
     heatmaps = None
     for i, landmarks in enumerate(landmarks_multiple):
         preprocessed_landmarks = self.preprocess_landmarks(landmarks, transformation, flip)
         heatmap_image_generator = HeatmapImageGenerator(image_size=self.output_size_np,
                                                         sigma=self.sigma,
                                                         scale_factor=self.scale_factor,
                                                         normalize_center=self.normalize_center)
         current_heatmaps = heatmap_image_generator.generate_heatmaps(preprocessed_landmarks, self.stack_axis)
         if heatmaps is None:
             heatmaps = current_heatmaps
         else:
             heatmaps = np.maximum(heatmaps, current_heatmaps)
     return heatmaps
 def get(self, landmarks_multiple, transformation, **kwargs):
     """
     Return generated heatmaps
     :param landmarks_multiple: list of list of landmarks
     :param transformation: transformation to transform landmarks
     :return: generated heatmaps
     """
     output_size = kwargs.get('output_size', self.output_size)
     output_spacing = kwargs.get('output_spacing', self.output_spacing)
     heatmaps = None
     for i, landmarks in enumerate(landmarks_multiple):
         preprocessed_landmarks = self.preprocess_landmarks(landmarks, transformation, output_size, output_spacing)
         heatmap_image_generator = HeatmapImageGenerator(image_size=list(reversed(output_size)),
                                                         sigma=self.sigma,
                                                         scale_factor=self.scale_factor,
                                                         normalize_center=self.normalize_center)
         current_heatmaps = heatmap_image_generator.generate_heatmaps(preprocessed_landmarks, self.stack_axis)
         if heatmaps is None:
             heatmaps = current_heatmaps
         else:
             heatmaps = np.maximum(heatmaps, current_heatmaps)
     return heatmaps