Skip to content

Commit d165d8f

Browse files
committed
add 1D transform param in MR2D1D class
1 parent f9e8952 commit d165d8f

3 files changed

Lines changed: 49 additions & 492 deletions

File tree

src/libsparse3d/MR2D1D.cc

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ void MR2D1D::put_band(fltarray Band, int s2, int s1)
353353

354354
/****************************************************************************/
355355

356-
void MR2D1D::alloc (int iNx, int iNy, int iNz, type_transform Trans2D, int Ns2D, int Ns1D, Bool NoAlloc)
356+
void MR2D1D::alloc (int iNx, int iNy, int iNz, type_transform Trans2D, int Ns2D, int Ns1D, Bool NoAlloc, type_sb_filter Filter1D)
357357
{
358358
Nx = iNx;
359359
Ny = iNy;
@@ -366,7 +366,7 @@ void MR2D1D::alloc (int iNx, int iNy, int iNz, type_transform Trans2D, int Ns2D,
366366
Apply1DTrans = False;
367367
}
368368
else Apply1DTrans = True;
369-
;
369+
370370
Norm = NORM_L2;
371371
SB_Filter = F_MALLAT_7_9;
372372
Bord = I_CONT;
@@ -386,13 +386,16 @@ void MR2D1D::alloc (int iNx, int iNy, int iNz, type_transform Trans2D, int Ns2D,
386386
WT2D.alloc (Ny, Nx, Ns2D, Trans2D, PtrFAS, Norm, NbrUndec, U_Filter);
387387
NbrBand2D = WT2D.nbr_band();
388388

389-
390389
Bool Rebin=False;
391390
WT1D.U_Filter = U_Filter;
391+
FilterAnaSynt *PtrFAS1D = NULL;
392+
FAS1D.Verbose = Verbose;
393+
FAS1D.alloc(Filter1D);
394+
PtrFAS1D = &FAS1D;
392395
type_trans_1d Trans1D = TO1_MALLAT;
393396
if (Apply1DTrans == True)
394397
{
395-
WT1D.alloc (Nz, Trans1D, Ns1D, PtrFAS, Norm, Rebin);
398+
WT1D.alloc (Nz, Trans1D, Ns1D, PtrFAS1D, Norm, Rebin);
396399
NbrBand1D = WT1D.nbr_band();
397400
}
398401
else NbrBand1D = 1;
@@ -518,8 +521,6 @@ void MR2D1D::transform (fltarray &Data)
518521

519522
/****************************************************************************/
520523

521-
522-
523524
void MR2D1D::recons (fltarray &Data)
524525
{
525526
if ((Data.nx() != Nx) || (Data.ny() != Ny) || (Data.nz() != Nz)) Data.resize(Nx, Ny, Nz);
@@ -563,4 +564,21 @@ void MR2D1D::recons (fltarray &Data)
563564

564565
/****************************************************************************/
565566

566-
567+
void MR2D1D::info()
568+
{
569+
cout << "Transform = " << StringTransform((type_transform) WT2D.Type_Transform) << endl;
570+
cout << "nb_scale_2d = " << NbrBand2D << endl;
571+
cout << "NbrScale1d = " << NbrBand1D << endl;
572+
cout << "Nx = " << Nx << " Ny = " << Ny << " Nz = " << Nz << endl;
573+
cout << endl;
574+
for (int s2 = 0; s2 < NbrBand2D; s2++)
575+
for (int s1 = 0; s1 < NbrBand1D; s1++)
576+
{
577+
cout << " Band " << s2 << ", " << s1 << ": " << " Nx = " << size_band_nx(s2,s1) << ", Ny = " << size_band_ny(s2,s1) << ", Nz = " << size_band_nz(s2,s1) << endl;
578+
fltarray Band;
579+
Band = get_band(s2, s1);
580+
cout << " Sigma = " << Band.sigma() << " Min = " << Band.min() << " Max = " << Band.max() << endl;
581+
}
582+
}
583+
584+
/****************************************************************************/

src/libsparse3d/MR2D1D.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class MR2D1D {
4747
int NbrCoef2D; // Number of coefficients in the 2D multiscale transform
4848
int NbrCoef1D; // Number of coefficients in the 1D multiscale transform
4949

50-
public: // ATTENTION JE L'AI MIS ICI ET NON PLUS LOIN !!
50+
public:
5151

5252
MultiResol WT2D; // 2D Multiresolution object
5353
MR_1D WT1D; // 1D Multiresolution object
@@ -65,13 +65,14 @@ class MR2D1D {
6565
type_border Bord; // Parameter for border management
6666
type_undec_filter U_Filter; // Type of filter in case of undecimated WT
6767
FilterAnaSynt FAS; // Filter bank object
68-
68+
FilterAnaSynt FAS1D; // Filter bank object
69+
6970
int mr_io_fill_header(fitsfile *fptr);
7071
//public:
7172
Bool Verbose;
7273
MR2D1D (){ NbrBand2D=NbrBand1D=0;Verbose=False;}
7374

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

136+
void info();
137+
135138
~MR2D1D() { if (TabBand != NULL) delete [] TabBand; NbrBand1D=NbrBand2D=NbrScale1D=NbrScale2D=0;}
136139
};
137140

0 commit comments

Comments
 (0)