Exemple #1
0
 def __init__(self, image_data, copy=True):
     Landmarkable.__init__(self)
     if not copy:
         # Let's check we don't do a copy!
         image_data_handle = image_data
         self.pixels = np.require(image_data, requirements=['C'])
         if self.pixels is not image_data_handle:
             raise Warning('The copy flag was NOT honoured. '
                           'A copy HAS been made. Please ensure the data '
                           'you pass is C-contiguous.')
     else:
         image_data = np.array(image_data, copy=True, order='C')
         # Degenerate case whereby we can just put the extra axis
         # on ourselves
         if image_data.ndim == 2:
             image_data = image_data[..., None]
         if image_data.ndim < 2:
             raise ValueError(
                 "Pixel array has to be 2D (2D shape, implicitly "
                 "1 channel) or 3D+ (2D+ shape, n_channels) "
                 " - a {}D array "
                 "was provided".format(image_data.ndim))
         self.pixels = np.require(image_data, requirements=['C'])
     # add FeatureExtraction functionality
     self.features = ImageFeatures(self)
Exemple #2
0
 def __init__(self, image_data):
     Landmarkable.__init__(self)
     image_data = np.array(image_data, copy=True, order='C')
     # This is the degenerate case whereby we can just put the extra axis
     # on ourselves
     if image_data.ndim == 2:
         image_data = image_data[..., None]
     if image_data.ndim < 2:
         raise ValueError("Pixel array has to be 2D (2D shape, implicitly "
                          "1 channel) or 3D+ (2D+ shape, n_channels) "
                          " - a {}D array "
                          "was provided".format(image_data.ndim))
     self.pixels = image_data
     # add FeatureExtraction functionality
     self.features = FeatureExtraction(self)
Exemple #3
0
 def __init__(self, image_data):
     Landmarkable.__init__(self)
     image_data = np.array(image_data, copy=True, order='C')
     # This is the degenerate case whereby we can just put the extra axis
     # on ourselves
     if image_data.ndim == 2:
         image_data = image_data[..., None]
     if image_data.ndim < 2:
         raise ValueError("Pixel array has to be 2D (2D shape, implicitly "
                          "1 channel) or 3D+ (2D+ shape, n_channels) "
                          " - a {}D array "
                          "was provided".format(image_data.ndim))
     self.pixels = image_data
     # add FeatureExtraction functionality
     self.features = FeatureExtraction(self)