Ejemplo n.º 1
0
    def undecimated(cls, nb_scale, iso_shape, nb_band):
        """ Compute undecimated transformation parameters.

        Parameters
        ----------
        nb_scale: int
            the number of scale of the decomposition that includes the
            approximation scale.
        iso_shape: int
            the data isotropic shape.
        nb_band: int
            the number of band.

        Returns
        -------
        bands_names: list of str
            the name of the different bands.
        flatten_fct: int
            a function used to reorganize the ISAP decomposition coefficients,
            see 'pysap/extensions/formating.py' module for more details.
        unflatten_fct: callable
            a function used to reorganize the decomposition coefficients using
            ISAP convention, see 'pysap/extensions/formating.py' module for
            more details.
        is_decimated: bool
            True if the decomposition include a decimation of the
            band number of coefficients.
        nb_band_per_scale: ndarray (<nb_scale>, )
            vector of int holding the number of band per scale.
        bands_lengths: ndarray (<nb_scale>, max(<nb_band_per_scale>, 0))
            array holding the length between two bands of the data
            vector per scale.
        bands_shapes: list of list of 2-uplet (<nb_scale>, <nb_band_per_scale>)
            structure holding the shape of each bands at each scale.
        """
        if nb_band == 1:
            bands_names = ["a"]
        elif nb_band == 2:
            bands_names = ["d1", "d2"]
        elif nb_band == 3:
            bands_names = ["v", "d", "h"]
        else:
            raise ValueError("'{0} bands not yet accepted.".format(nb_band))
        flatten_fct = ISAP_FLATTEN[0]
        unflatten_fct = ISAP_UNFLATTEN[0]
        is_decimated = False
        nb_band_per_scale = numpy.ones((nb_scale, 1), dtype=int)
        nb_band_per_scale[:-1] = nb_band
        bands_lengths = (
            (iso_shape * iso_shape)
            * numpy.ones((nb_scale, nb_band), dtype=int))
        bands_shapes = WaveletTransformBase.bands_shapes(bands_lengths)

        return (bands_names, flatten_fct, unflatten_fct, is_decimated,
                nb_band_per_scale, bands_lengths, bands_shapes)
Ejemplo n.º 2
0
 def _set_transformation_parameters(self):
     raise NotImplementedError(
         "This transformation is not yet accessible from the wrapping, "
         "please use the Python bindings.")
     _map = {128: 5, 512: 6}
     self.nb_scale = _map[self._iso_shape]  # fixed for this wavelet
     self.name = "Line Column Wavelet Transform (1D+1D)"
     self.bands_names = ['d%d' % i for i in range(_map[self._iso_shape])]
     self.nb_band_per_scale = numpy.array([_map[self._iso_shape]] *
                                          nb_scale)
     self.bands_lengths = ((self._iso_shape * self._iso_shape) * numpy.ones(
         (nb_scale, _map[self._iso_shape]), dtype=int))
     self.bands_shapes = WaveletTransformBase.bands_shapes(bands_lengths)
     self.isap_transform_id = 17
     self.flatten_fct = ISAP_FLATTEN[0]
     self.is_decimated = False