Line data Source code
1 : //# ImageDataSampling.cc: Implementation of ImageDataSampling class
2 : //# Copyright (C) 1997,1998,1999,2000,2001,2003
3 : //# Associated Universities, Inc. Washington DC, USA.
4 : //#
5 : //# This library is free software; you can redistribute it and/or modify it
6 : //# under the terms of the GNU Library General Public License as published by
7 : //# the Free Software Foundation; either version 2 of the License, or (at your
8 : //# option) any later version.
9 : //#
10 : //# This library is distributed in the hope that it will be useful, but WITHOUT
11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 : //# License for more details.
14 : //#
15 : //# You should have received a copy of the GNU Library General Public License
16 : //# along with this library; if not, write to the Free Software Foundation,
17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 : //#
19 : //# Correspondence concerning AIPS++ should be addressed as follows:
20 : //# Internet email: casa-feedback@nrao.edu.
21 : //# Postal address: AIPS++ Project Office
22 : //# National Radio Astronomy Observatory
23 : //# 520 Edgemont Road
24 : //# Charlottesville, VA 22903-2475 USA
25 : //#
26 : //# $Id$
27 :
28 : #include <synthesis/DataSampling/ImageDataSampling.h>
29 : #include <casacore/casa/BasicSL/Constants.h>
30 : #include <casacore/images/Images/ImageInterface.h>
31 : #include <casacore/images/Images/TempImage.h>
32 : #include <casacore/casa/Arrays/ArrayLogical.h>
33 : #include <casacore/casa/Arrays/ArrayMath.h>
34 : #include <casacore/casa/Arrays/MaskedArray.h>
35 : #include <casacore/casa/Arrays/Array.h>
36 : #include <casacore/casa/Arrays/Array.h>
37 : #include <casacore/casa/Arrays/Vector.h>
38 : #include <casacore/casa/Arrays/Matrix.h>
39 : #include <casacore/casa/BasicSL/String.h>
40 : #include <casacore/casa/Utilities/Assert.h>
41 : #include <casacore/casa/Exceptions/Error.h>
42 : #include <sstream>
43 :
44 : using namespace casacore;
45 : namespace casa { //# NAMESPACE CASA - BEGIN
46 :
47 0 : ImageDataSampling::ImageDataSampling(const ImageInterface<Float>& dirty,
48 : const ImageInterface<Float>& psf,
49 0 : const ImageInterface<Float>& sigma)
50 : {
51 0 : ImageDataSampling::init(dirty, psf, &sigma, 0.0);
52 0 : DataSampling::IDLScript_p="@app_image";
53 0 : }
54 :
55 0 : ImageDataSampling::ImageDataSampling(const ImageInterface<Float>& dirty,
56 : const ImageInterface<Float>& psf,
57 0 : const Float sigma)
58 : {
59 0 : ImageInterface<Float>* sigmaImagePtr=0;
60 0 : ImageDataSampling::init(dirty, psf, sigmaImagePtr, sigma);
61 0 : DataSampling::IDLScript_p="@app_image";
62 0 : }
63 :
64 : //----------------------------------------------------------------------
65 0 : ImageDataSampling& ImageDataSampling::operator=(const ImageDataSampling& other)
66 : {
67 : if(this!=&other) {
68 : };
69 0 : return *this;
70 : };
71 :
72 : //----------------------------------------------------------------------
73 0 : ImageDataSampling::ImageDataSampling(const ImageDataSampling& other):
74 0 : DataSampling(other)
75 : {
76 0 : operator=(other);
77 0 : }
78 :
79 : //----------------------------------------------------------------------
80 0 : ImageDataSampling::~ImageDataSampling() {
81 0 : }
82 :
83 0 : void ImageDataSampling::init(const ImageInterface<Float>& dirty,
84 : const ImageInterface<Float>& psf,
85 : const ImageInterface<Float>* sigmaImagePtr,
86 : const Float sigma)
87 : {
88 :
89 0 : ok();
90 :
91 0 : Int nx = dirty.shape()(0);
92 0 : Int ny = dirty.shape()(1);
93 :
94 0 : dx_p.resize(IPosition(2, 2, nx*ny)); dx_p=0.0;
95 0 : data_p.resize(IPosition(2, nx, ny)); data_p=0.0;
96 0 : sigma_p.resize(IPosition(2, nx, ny)); sigma_p=sigma;
97 0 : prf_p.resize(IPosition(2, nx, ny)); prf_p=0.0;
98 :
99 : // Fill in data, dx, and prf
100 0 : IPosition zero(dirty.shape().nelements(), 0);
101 0 : IPosition onePlane(dirty.shape().nelements(), 1);
102 0 : onePlane(0)=nx;
103 0 : onePlane(1)=ny;
104 0 : data_p=dirty.getSlice(zero, onePlane, true);
105 0 : prf_p=psf.getSlice(zero, onePlane, true);
106 0 : if(sigmaImagePtr) {
107 0 : sigma_p=sigmaImagePtr->getSlice(zero, onePlane, true);
108 : }
109 :
110 0 : Int row=0;
111 0 : for (Int iy=0;iy<ny;iy++) {
112 0 : for (Int ix=0;ix<nx;ix++) {
113 0 : dx_p(IPosition(2, 0, row))=Float(ix);
114 0 : dx_p(IPosition(2, 1, row))=Float(iy);
115 0 : row++;
116 : }
117 : }
118 0 : }
119 :
120 0 : void ImageDataSampling::ok() {
121 0 : }
122 :
123 : } //# NAMESPACE CASA - END
124 :
|