1 #include "PlusConfigure.h" 6 #include "ResearchInterface.h" 35 LOG_DEBUG(
"Prepare: samples" << samples <<
", lines=" << lines <<
", pitch=" << pitch);
39 LOG_ERROR(
"Invalid lines argument sent to Prepare. Cannot process negative values.");
43 unsigned int maxNumberOfLines = static_cast<unsigned int>(lines);
58 if (numberOfRfSamplesPerLine + 6 < 0)
60 LOG_ERROR(
"numberOfRfSamplesPerLine is negative. Cannot continue.");
72 LOG_ERROR(
"PlusBkProFocusCameraLinkReceiver::Prepare: Failed to allocate memory for m_Frame");
95 if (frameData == NULL)
97 LOG_DEBUG(
"DataAvailable received empty m_Frame");
102 LOG_ERROR(
"Frame buffer is not initialized");
107 LOG_ERROR(
"No video source callback is set");
111 const ResearchInterfaceLineHeader* header = reinterpret_cast<const ResearchInterfaceLineHeader*>(frameData);
112 const unsigned char* inputFrame = reinterpret_cast<const unsigned char*>(frameData);
118 unsigned int numberOfSamplePairsInInput = numberOfSamplesInInput / 2;
120 unsigned int numberOfSamplePairsToCopy = 0;
121 if (numberOfSamplePairsInOutput == numberOfSamplePairsInInput)
123 numberOfSamplePairsToCopy = numberOfSamplePairsInOutput;
125 else if (numberOfSamplePairsInOutput < numberOfSamplePairsInInput)
127 LOG_WARNING(
"Not enough space allocated to store all the RF samples. Input: " << numberOfSamplePairsInInput <<
", output: " << numberOfSamplePairsInOutput);
128 numberOfSamplePairsToCopy = numberOfSamplePairsInOutput;
132 LOG_WARNING(
"Not enough samples are available in the acquired frame, the end of the RF lines will be undefined");
133 numberOfSamplePairsToCopy = numberOfSamplePairsInInput;
136 unsigned int numBmodeLines = 0;
137 for (
int inputLineIndex = 0; inputLineIndex < lines; ++inputLineIndex)
141 header = reinterpret_cast<const ResearchInterfaceLineHeader*>(inputFrame + inputLineIndex * pitch);
143 if (header->ModelID != 0 || header->CFM != 0 || header->FFT != 0)
152 LOG_WARNING(
"Not enough lines are available in the frame buffer, ignore the acquired line");
160 const int32_t* currentInputPosition = reinterpret_cast<const int32_t*>(inputFrame + inputLineIndex * pitch +
HEADER_SIZE_BYTES);
164 for (
int samplePairIndex = 0; samplePairIndex < numberOfSamplePairsToCopy; ++samplePairIndex)
166 *currentOutputPosition = *currentInputPosition;
168 ++currentOutputPosition;
175 if (numBmodeLines == 0)
177 LOG_DEBUG(
"No B-mode compatible image lines were found");
185 LOG_ERROR(
"B-mode imaging is not supported");
199 LOG_ERROR(
"Invalid imaging mode requested: " <<
m_ImagingMode);
unsigned int m_NumberOfRfSamplesPerLine
virtual void SetImagingMode(vtkPlusBkProFocusCameraLinkVideoSource::ImagingModeType imagingMode)
virtual void SetDecimation(int decimation)
virtual bool DataAvailable(int lines, int pitch, void const *frameData)
vtkPlusBkProFocusCameraLinkVideoSource::ImagingModeType m_ImagingMode
const int HEADER_SIZE_BYTES
virtual ~PlusBkProFocusCameraLinkReceiver()
vtkPlusBkProFocusCameraLinkVideoSource * m_CallbackVideoSource
void NewFrameCallback(void *pixelDataPtr, const FrameSizeType &frameSizeInPix, igsioCommon::VTKScalarPixelType pixelType, US_IMAGE_TYPE imageType)
Class for acquiring ultrasound images from BK ProFocus scanners.
virtual bool Prepare(int samples, int lines, int pitch)
virtual void SetPlusVideoSource(vtkPlusBkProFocusCameraLinkVideoSource *videoSource)
unsigned int m_MaxNumberOfLines
const int BYTES_PER_SAMPLE
PlusBkProFocusCameraLinkReceiver()