diff --git a/src/PlusDataCollection/Andor/vtkPlusAndorVideoSource.cxx b/src/PlusDataCollection/Andor/vtkPlusAndorVideoSource.cxx index 6672cb7d1..a036f937b 100644 --- a/src/PlusDataCollection/Andor/vtkPlusAndorVideoSource.cxx +++ b/src/PlusDataCollection/Andor/vtkPlusAndorVideoSource.cxx @@ -434,6 +434,37 @@ void vtkPlusAndorVideoSource::AdjustSpacing(int horizontalBins, int verticalBins LOG_DEBUG("Adjusted spacing: " << spacingStream.str()); } +// ---------------------------------------------------------------------------- +void vtkPlusAndorVideoSource::SetCustomFrameFields() +{ + this->CustomFields["ExposureTime"].first = FRAMEFIELD_FORCE_SERVER_SEND; + this->CustomFields["ExposureTime"].second = std::to_string(this->effectiveExpTime); + this->CustomFields["HorizontalBins"].first = FRAMEFIELD_FORCE_SERVER_SEND; + this->CustomFields["HorizontalBins"].second = std::to_string(this->effectiveHBins); + this->CustomFields["VerticalBins"].first = FRAMEFIELD_FORCE_SERVER_SEND; + this->CustomFields["VerticalBins"].second = std::to_string(this->effectiveVBins); + + std::ostringstream transformStream; + float transformValue; + for(unsigned i = 0; i < 15; i++) + { + transformValue = this->imageToReferenceTransform.at(i); + if (i == 0) + { + transformValue = transformValue * this->OutputSpacing[0] * this->effectiveHBins; + } + else if (i == 5) // 1,1 in the matrix + { + transformValue = transformValue * this->OutputSpacing[1] * this->effectiveVBins; + } + transformStream << this->imageToReferenceTransform.at(i) << " "; + } + transformStream << this->imageToReferenceTransform.back(); + + this->CustomFields["ImageToReferenceTransform"].first = FRAMEFIELD_FORCE_SERVER_SEND; + this->CustomFields["ImageToReferenceTransform"].second = transformStream.str(); +} + // ---------------------------------------------------------------------------- PlusStatus vtkPlusAndorVideoSource::SetFrameFieldImageToReferenceTransform(std::array transform) { @@ -508,6 +539,8 @@ PlusStatus vtkPlusAndorVideoSource::AcquireFrame() AdjustBuffers(this->effectiveHBins, this->effectiveVBins); AdjustSpacing(this->effectiveHBins, this->effectiveVBins); + SetCustomFrameFields(); + unsigned rawFrameSize = frameSize[0] * frameSize[1]; rawFrame.resize(rawFrameSize, 0); diff --git a/src/PlusDataCollection/Andor/vtkPlusAndorVideoSource.h b/src/PlusDataCollection/Andor/vtkPlusAndorVideoSource.h index 3d09c0697..bc14ea466 100644 --- a/src/PlusDataCollection/Andor/vtkPlusAndorVideoSource.h +++ b/src/PlusDataCollection/Andor/vtkPlusAndorVideoSource.h @@ -260,6 +260,9 @@ class vtkPlusDataCollectionExport vtkPlusAndorVideoSource: public vtkPlusDevice void AdjustBuffers(int horizontalBins, int verticalBins); void AdjustSpacing(int horizontalBins, int verticalBins); + /*! Set some acquisition parameters as per-frame header fields */ + void SetCustomFrameFields(); + /*! Acquire a single frame using current parameters. Data is put in the frameBuffer ivar. */ PlusStatus AcquireFrame();