Noisy pixels masking

From ADVACAM Wiki
Revision as of 14:24, 24 April 2024 by MarekL (talk | contribs)
Jump to navigation Jump to search

The detector can be changed due to the environment conditions.

Method description

Two types of noisy pixels are defined: saturated and oscillating.

The saturated pixels

Implementation in Pixet C++ API

The function definition can be found below:

// Finds noisy pixels and it can optionally masked them. Designed for devices in environment WITHOUT radiation background.
// [in] deviceIndex - index of the device (indexing starting from 0)
// [in] limitNoisy - limit to mask noisy pixels. It goes from 1 to 1022, where 1 is the most strongest masking and 1022 is the weakest.
// [in] limitSatur - limit to mask saturated pixels. It goes from 0 to 100, where 0 is the most strongest masking and 100 is the weakest.
// [in] doMaskNoisyPixels - check to mask noisy pixels within the process. Default is false alias do not mask.
// [in] matrixSize - size of the matrix.
// [in/out] noisyPixelsMatrix - mask/positions of noisy pixels.
PXCAPI int pxcFindNoisyPixelsTpx3(unsigned deviceIndex, double limitNoisy = 50, double limitSatur = 50, bool doMaskNoisyPixels = false, 
                                unsigned* noisyPixelsMatrix = nullptr, unsigned matrixSize = 65536);

More detailed explanation of the individual parameters influencing the masking performance can be fount in the list below:

  • limitNoisy - asdasd
  • limitSatur -


Example of usage:

#include "pxcapi.h"
#include <string>

int main() 
{
    int rc=  0;

    rc = pxcInitialize();

    // std::string devCofig = "/home/lukas/file/sw/pixet/src/pixet_noisy_pix/devel/MiniPIX-I08-W0060_2noisypix.xml";
    // rc = pxcLoadDeviceConfiguration(0, devCofig.c_str());

    double limitNoisy = 10;
    double limitSatur = 50;
    unsigned matrixSize = 65536;
    unsigned int noisyPixelsMatrix[matrixSize];
        
    rc = pxcFindNoisyPixelsTpx3(0, limitNoisy, limitSatur, true, noisyPixelsMatrix, matrixSize);
    
    printf("------------------------------\n");    
    printf("Found noisy pixels\n");
    for (int i = 0; i < matrixSize; ++i)
    {
        if(noisyPixelsMatrix[i] == 1)
            printf("%d\t%d\n", i, noisyPixelsMatrix[i] );
    }

    printf("------------------------------\n");
    printf("Additional frame measurement to check hit pixels\n");

    double dataIToT[matrixSize];
    unsigned short dataCount[matrixSize];

    rc = pxcMeasureSingleFrameTpx3(0, 0.1, dataIToT, dataCount, &matrixSize, PXC_TRG_NO);
    
    for (int i = 0; i < matrixSize; ++i)
    {
        if(dataIToT[i] >= 1 or dataCount[i] >= 1)
            printf("%d\t%.0f\t%d\n",i, dataIToT[i], dataCount[i]);
    }  
    printf("------------------------------\n");
    printf("Additional measurement in data driven\n");

    rc = pxcSetTimepix3Mode(0, PXC_TPX3_OPM_TOATOT);    
    rc = pxcMeasureTpx3DataDrivenMode(0, 1, "data.t3pa");

    printf("------------------------------\n");

    rc = pxcExit();
}