Skip to content

Commit

Permalink
add 1D transform param in MR2D1D class
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarck committed Mar 7, 2021
1 parent f9e8952 commit d165d8f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 492 deletions.
32 changes: 25 additions & 7 deletions src/libsparse3d/MR2D1D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ void MR2D1D::put_band(fltarray Band, int s2, int s1)

/****************************************************************************/

void MR2D1D::alloc (int iNx, int iNy, int iNz, type_transform Trans2D, int Ns2D, int Ns1D, Bool NoAlloc)
void MR2D1D::alloc (int iNx, int iNy, int iNz, type_transform Trans2D, int Ns2D, int Ns1D, Bool NoAlloc, type_sb_filter Filter1D)
{
Nx = iNx;
Ny = iNy;
Expand All @@ -366,7 +366,7 @@ void MR2D1D::alloc (int iNx, int iNy, int iNz, type_transform Trans2D, int Ns2D,
Apply1DTrans = False;
}
else Apply1DTrans = True;
;

Norm = NORM_L2;
SB_Filter = F_MALLAT_7_9;
Bord = I_CONT;
Expand All @@ -386,13 +386,16 @@ void MR2D1D::alloc (int iNx, int iNy, int iNz, type_transform Trans2D, int Ns2D,
WT2D.alloc (Ny, Nx, Ns2D, Trans2D, PtrFAS, Norm, NbrUndec, U_Filter);
NbrBand2D = WT2D.nbr_band();


Bool Rebin=False;
WT1D.U_Filter = U_Filter;
FilterAnaSynt *PtrFAS1D = NULL;
FAS1D.Verbose = Verbose;
FAS1D.alloc(Filter1D);
PtrFAS1D = &FAS1D;
type_trans_1d Trans1D = TO1_MALLAT;
if (Apply1DTrans == True)
{
WT1D.alloc (Nz, Trans1D, Ns1D, PtrFAS, Norm, Rebin);
WT1D.alloc (Nz, Trans1D, Ns1D, PtrFAS1D, Norm, Rebin);
NbrBand1D = WT1D.nbr_band();
}
else NbrBand1D = 1;
Expand Down Expand Up @@ -518,8 +521,6 @@ void MR2D1D::transform (fltarray &Data)

/****************************************************************************/



void MR2D1D::recons (fltarray &Data)
{
if ((Data.nx() != Nx) || (Data.ny() != Ny) || (Data.nz() != Nz)) Data.resize(Nx, Ny, Nz);
Expand Down Expand Up @@ -563,4 +564,21 @@ void MR2D1D::recons (fltarray &Data)

/****************************************************************************/


void MR2D1D::info()
{
cout << "Transform = " << StringTransform((type_transform) WT2D.Type_Transform) << endl;
cout << "nb_scale_2d = " << NbrBand2D << endl;
cout << "NbrScale1d = " << NbrBand1D << endl;
cout << "Nx = " << Nx << " Ny = " << Ny << " Nz = " << Nz << endl;
cout << endl;
for (int s2 = 0; s2 < NbrBand2D; s2++)
for (int s1 = 0; s1 < NbrBand1D; s1++)
{
cout << " Band " << s2 << ", " << s1 << ": " << " Nx = " << size_band_nx(s2,s1) << ", Ny = " << size_band_ny(s2,s1) << ", Nz = " << size_band_nz(s2,s1) << endl;
fltarray Band;
Band = get_band(s2, s1);
cout << " Sigma = " << Band.sigma() << " Min = " << Band.min() << " Max = " << Band.max() << endl;
}
}

/****************************************************************************/
9 changes: 6 additions & 3 deletions src/libsparse3d/MR2D1D.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class MR2D1D {
int NbrCoef2D; // Number of coefficients in the 2D multiscale transform
int NbrCoef1D; // Number of coefficients in the 1D multiscale transform

public: // ATTENTION JE L'AI MIS ICI ET NON PLUS LOIN !!
public:

MultiResol WT2D; // 2D Multiresolution object
MR_1D WT1D; // 1D Multiresolution object
Expand All @@ -65,13 +65,14 @@ class MR2D1D {
type_border Bord; // Parameter for border management
type_undec_filter U_Filter; // Type of filter in case of undecimated WT
FilterAnaSynt FAS; // Filter bank object

FilterAnaSynt FAS1D; // Filter bank object

int mr_io_fill_header(fitsfile *fptr);
//public:
Bool Verbose;
MR2D1D (){ NbrBand2D=NbrBand1D=0;Verbose=False;}

void alloc(int iNx, int iNy, int iNz, type_transform Trans2D, int Ns2D, int Ns1D=0, Bool NoAlloc=False);
void alloc(int iNx, int iNy, int iNz, type_transform Trans2D, int Ns2D, int Ns1D=0, Bool NoAlloc=False, type_sb_filter Filter1D=F_MALLAT_7_9);
// Allocate the class for a cube of size (iNx, iNy, iNz) using Ns2D scale in 2D and Ns1D scale in 1D
// If Ns1D < 2 then no wavelet transform is performed along z axis
// If NoAlloc=True, then TabBand is not allocated and ONLY routine transform_to_vectarray can be used
Expand Down Expand Up @@ -132,6 +133,8 @@ class MR2D1D {
float & operator() (int s2, int i, int j, int k) const;
// Return one coefficient, for the case where no 1D WT is applied

void info();

~MR2D1D() { if (TabBand != NULL) delete [] TabBand; NbrBand1D=NbrBand2D=NbrScale1D=NbrScale2D=0;}
};

Expand Down
Loading

0 comments on commit d165d8f

Please sign in to comment.