private static BackgroundFOV[] GetAllChannelsBackgroundFOVs(Tiff scanTiff, int projectId, int runId) { BackgroundFOV[] backgroundFOVs = new BackgroundFOV[totalChannels]; for (int currChannel = 0; currChannel < totalChannels; currChannel++) { backgroundFOVs[currChannel] = new BackgroundFOV(currChannel, imageLength, imageWidth); backgroundFOVs[currChannel].CalculateBackground(scanTiff, projectId, runId); } return(backgroundFOVs); }
private static void SubtractFrameBackground(short[][] frame, BackgroundFOV backgroundFOV) { short newPixelVal; for (int row = 0; row < imageLength; row++) { for (int col = 0; col < imageWidth; col++) { newPixelVal = (short)(frame[row][col] / backgroundFOV.PixelValues[row][col] * backgroundFOV.AverageValue - (backgroundFOV.AverageValue + backgroundFOV.StandardDev)); frame[row][col] = newPixelVal > 0 ? newPixelVal : (short)0; } } }