Skip to content

Commit 8cdf475

Browse files
adamajiadamrankin
authored andcommitted
ENH: Set custom frame fields per Andor frame acquisition
1 parent c8220bb commit 8cdf475

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

src/PlusDataCollection/Andor/vtkPlusAndorVideoSource.cxx

+33
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,37 @@ void vtkPlusAndorVideoSource::AdjustSpacing(int horizontalBins, int verticalBins
434434
LOG_DEBUG("Adjusted spacing: " << spacingStream.str());
435435
}
436436

437+
// ----------------------------------------------------------------------------
438+
void vtkPlusAndorVideoSource::SetCustomFrameFields()
439+
{
440+
this->CustomFields["ExposureTime"].first = FRAMEFIELD_FORCE_SERVER_SEND;
441+
this->CustomFields["ExposureTime"].second = std::to_string(this->effectiveExpTime);
442+
this->CustomFields["HorizontalBins"].first = FRAMEFIELD_FORCE_SERVER_SEND;
443+
this->CustomFields["HorizontalBins"].second = std::to_string(this->effectiveHBins);
444+
this->CustomFields["VerticalBins"].first = FRAMEFIELD_FORCE_SERVER_SEND;
445+
this->CustomFields["VerticalBins"].second = std::to_string(this->effectiveVBins);
446+
447+
std::ostringstream transformStream;
448+
float transformValue;
449+
for(unsigned i = 0; i < 15; i++)
450+
{
451+
transformValue = this->imageToReferenceTransform.at(i);
452+
if (i == 0)
453+
{
454+
transformValue = transformValue * this->OutputSpacing[0] * this->effectiveHBins;
455+
}
456+
else if (i == 5) // 1,1 in the matrix
457+
{
458+
transformValue = transformValue * this->OutputSpacing[1] * this->effectiveVBins;
459+
}
460+
transformStream << this->imageToReferenceTransform.at(i) << " ";
461+
}
462+
transformStream << this->imageToReferenceTransform.back();
463+
464+
this->CustomFields["ImageToReferenceTransform"].first = FRAMEFIELD_FORCE_SERVER_SEND;
465+
this->CustomFields["ImageToReferenceTransform"].second = transformStream.str();
466+
}
467+
437468
// ----------------------------------------------------------------------------
438469
PlusStatus vtkPlusAndorVideoSource::SetFrameFieldImageToReferenceTransform(std::array<float, 16> transform)
439470
{
@@ -508,6 +539,8 @@ PlusStatus vtkPlusAndorVideoSource::AcquireFrame()
508539
AdjustBuffers(this->effectiveHBins, this->effectiveVBins);
509540
AdjustSpacing(this->effectiveHBins, this->effectiveVBins);
510541

542+
SetCustomFrameFields();
543+
511544
unsigned rawFrameSize = frameSize[0] * frameSize[1];
512545
rawFrame.resize(rawFrameSize, 0);
513546

src/PlusDataCollection/Andor/vtkPlusAndorVideoSource.h

+3
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@ class vtkPlusDataCollectionExport vtkPlusAndorVideoSource: public vtkPlusDevice
260260
void AdjustBuffers(int horizontalBins, int verticalBins);
261261
void AdjustSpacing(int horizontalBins, int verticalBins);
262262

263+
/*! Set some acquisition parameters as per-frame header fields */
264+
void SetCustomFrameFields();
265+
263266
/*! Acquire a single frame using current parameters. Data is put in the frameBuffer ivar. */
264267
PlusStatus AcquireFrame();
265268

0 commit comments

Comments
 (0)