/** Calculate the normalization term for each output bin * @param wavStart [in] the index number of the first bin in the input * wavelengths that is actually being used * @param specInd [in] the spectrum to calculate * @param pixelAdj [in] if not NULL this is workspace contains single bins with * the adjustments, e.g. detector efficencies, for the given spectrum index * @param wavePixelAdj [in] if not NULL this is workspace that contains the * adjustments for the pixels and wavelenght dependend values. * @param binNorms [in] pointer to a contigious array of doubles that are the * wavelength correction from waveAdj workspace, can be NULL * @param binNormEs [in] pointer to a contigious array of doubles which * corrospond to the corrections and are their errors, can be NULL * @param norm [out] normalization for each bin, including soild angle, pixel * correction, the proportion that is not masked and the normalization workspace * @param normETo2 [out] this pointer must point to the end of the norm array, * it will be filled with the total of the error on the normalization */ void Q1D2::calculateNormalization(const size_t wavStart, const size_t specInd, API::MatrixWorkspace_const_sptr pixelAdj, API::MatrixWorkspace_const_sptr wavePixelAdj, double const *const binNorms, double const *const binNormEs, const MantidVec::iterator norm, const MantidVec::iterator normETo2) const { double detectorAdj, detAdjErr; pixelWeight(pixelAdj, specInd, detectorAdj, detAdjErr); // use that the normalization array ends at the start of the error array for (MantidVec::iterator n = norm, e = normETo2; n != normETo2; ++n, ++e) { *n = detectorAdj; *e = detAdjErr *detAdjErr; } if (binNorms && binNormEs) { if (wavePixelAdj) // pass the iterator for the wave pixel Adj dependent addWaveAdj(binNorms + wavStart, binNormEs + wavStart, norm, normETo2, wavePixelAdj->readY(specInd).begin() + wavStart, wavePixelAdj->readE(specInd).begin() + wavStart); else addWaveAdj(binNorms + wavStart, binNormEs + wavStart, norm, normETo2); } normToMask(wavStart, specInd, norm, normETo2); }
void applyFilter(IMAGE *image){ // incremention variables int i,j; BYTE filterOne[3][3] = { {0, 0, 0}, {0, 1, 0}, {0, 0, 0} }; // copy to the mirrorArray BYTE mirrorArray[(512+2)][(512+2)]; for(i = 1; i < 512+1; i++){ for(j = 1; j < 512+1; j++ ){ mirrorArray[i][j] = image->Pixels[i+512*j]; } } for(i = 1; i <= 512; i++){ mirrorArray[i][0] = mirrorArray[i+1][0]; mirrorArray[0][i] = mirrorArray[0][i+1]; mirrorArray[513][i] = mirrorArray[513][i-1]; mirrorArray[i][513] = mirrorArray[i-1][513]; } mirrorArray[0][0] = mirrorArray[0+1][0+1]; mirrorArray[0][513] = mirrorArray[1][513-1]; mirrorArray[513][0] = mirrorArray[513-1][0]; mirrorArray[513][513] = mirrorArray[513-1][513-1]; for(i = 0; i < 512*512; i++){ image->Pixels[i] = pixelWeight(i, mirrorArray, filterOne); /*todo check */ /*if((i % 100) == 0){ printf("%d :: %d\n", i, image->Pixels[i]); }*/ } }