This class handles computation of oversampled regions in the model image; there will be one instance for each oversampled region requested by the user (these are stored in ModelObject as a vector of pointers to individual OversampledRegion objects).
It holds information about the location, size, and pixel oversampling factor of the oversampled region; it also holds a Convolver object which performs PSF convolution using the appropriate oversampled PSF image.
Code contained in this class can generate an oversampled model-image region, using the FunctionObjects vector passed in by the caller (i.e., main’s ModelObject instance); this subimage is then convolved with the oversampled PSF and finally block-downsampled back to the main image’s pixel scale and copied into the corresponding pixels of the main model image. OpenMP compiler directives are used to speed up computation of the oversampled model subimage.
Setup and Use¶
To set up an OversampledRegion object, you first call its AddPSFVector method to pass in the PSF image data, size, and whether the PSF should be normalized. Then you tell the OversampledRegion object about the size of the main image, the location of the oversampled region, and the oversampling scale by calling the SetupModelImage method.
(See ModelObject::AddOversampledPSFVector for an example of how this is done in practice.)
To use an OversampledRegion object in the model-image-generation process, you call its ComputeRegionAndDownsample method, passing in a pointer to the current model image and the vector of FunctionObjects which describe the model. You should be sure to update the FunctionObjects with the current set of parameter values before doing this. (See ModelObject::CreateModelImage for an example of use.)
(In Imfit, this is all done within the ModelObject class.)
Class for computing oversampled model image region and downsampling to match main image, with optional PSF convolution using oversampled PSF.
AddPSFVector(double *psfPixels_input, int nColumns, int nRows, bool normalizePSF = true)¶
Pass in a pointer to the pixel vector for the input PSF image, as well as the image dimensions. We assume this is an oversampled PSF, with the same oversampling scale as specified in the input to SetupModelImage(), below
User specifies maximum number of FFTW threads to use (ignored if not compiled with multithreaded FFTW library)
SetupModelImage(int x1, int y1, int nBaseColumns, int nBaseRows, int nColumnsMain, int nRowsMain, int nColumnsPSF_main, int nRowsPSF_main, int oversampScale)¶
Pass in the dimensions of the image region, oversample scale, etc. x1,y1 = x,y location of lower-left corner of image region w/in main image (IRAF-numbering) nBaseColumns,nBaseRows = x,y size of region in main (“base”) image nColumnsMain, nRowsMain = x,y size of full main model (“base”) image
ComputeRegionAndDownsample(double *mainImageVector, vector<FunctionObject*> functionObjectVect, int nFunctionObjects)¶
This is the main method, which computes the oversampled (sub-region) model image, then downsamples it to the main image pixel scale and copies it into the main image (mainImageVector). We assume that the FunctionObjects pointed to by functionObjectVect have already been set up with the current parameter values by calling their individual Setup() methods e.g., by the method or function that is calling this method.