Exemplo n.º 1
0
    def apply(self, data, rotation=None):
        """
        @param rotation: apply rotation to the wedge first
        """
        # if no missing wedge
        if self.start_ang == -90 and self.end_ang == 90:
            return data

        if self._volume is not None and np.array_equal(self._volume_shape,
                                                       data.shape):
            pass
        else:
            self._create_wedge_volume(data.shape)

        if rotation is not None:  # rotate the wedge first
            assert len(rotation) == 3
            from pytom.tompy.transform import rotate3d, fourier_reduced2full, fourier_full2reduced, fftshift, ifftshift
            isodd = self._volume_shape[2] % 2
            filter_vol = fftshift(fourier_reduced2full(self._volume, isodd))
            filter_vol = rotate3d(filter_vol,
                                  rotation[0],
                                  rotation[1],
                                  rotation[2],
                                  order=1)  # linear interp!
            filter_vol = fourier_full2reduced(ifftshift(filter_vol))
        else:
            filter_vol = self._volume

        from pytom.tompy.transform import fourier_filter
        res = fourier_filter(data, filter_vol, False)

        return res
Exemplo n.º 2
0
    def set_wedge_volume(self, wedge_vol, half=True, isodd=False):
        if half:
            self._volume = wedge_vol

            # human understandable version with 0-freq in the center
            from transform import fourier_reduced2full, fftshift
            self._whole_volume = fftshift(
                fourier_reduced2full(self._volume, isodd))
        else:
            self._whole_volume = wedge_vol

            from transform import fourier_full2reduced, ifftshift
            self._volume = fourier_full2reduced(ifftshift(self._whole_volume))
Exemplo n.º 3
0
    def apply(self, data, rotation=None):
        if rotation is not None:  # rotate the wedge first
            assert len(rotation) == 3
            from transform import rotate3d, fourier_full2reduced, ifftshift
            filter_vol = rotate3d(self._whole_volume, rotation[0], rotation[1],
                                  rotation[2])
            filter_vol = fourier_full2reduced(ifftshift(filter_vol))
        else:
            filter_vol = self._volume

        from transform import fourier_filter
        res = fourier_filter(data, filter_vol, False)

        return res