10 #include "PlusConfigure.h" 16 #include <vtkImageData.h> 17 #include <vtkObjectFactory.h> 21 #include "sc2_SDKStructures.h" 22 #include "SC2_SDKAddendum.h" 23 #include "SC2_CamExport.h" 46 os << indent <<
"UltravioletPCOUVCam: PCO Ultraviolet Camera" << std::endl;
53 LOG_DEBUG(
"Configure PCO Ultaviolet");
55 const char* ExposureTimeString = deviceConfig->GetAttribute(
"ExposureTime");
56 const char* TimeBaseExposureString = deviceConfig->GetAttribute(
"TimeBaseExposure");
57 if (ExposureTimeString)
59 this->
dwExposure = std::atoi(ExposureTimeString);
66 if (TimeBaseExposureString)
104 PCO_Description strDescription;
105 PCO_CameraType strCamType;
107 DWORD CameraWarning, CameraError, CameraStatus;
112 WORD auxTimeBaseDelay;
113 WORD auxTimeBaseExposure;
117 iRet = PCO_OpenCamera(&(this->
cam), 0);
118 if (iRet != PCO_NOERROR)
120 LOG_ERROR(
"PCO Ultraviolet: camera not detected.");
124 LOG_DEBUG(
"PCO Ultraviolet: camera found.");
126 strDescription.wSize =
sizeof(PCO_Description);
127 iRet = PCO_GetCameraDescription(this->
cam, &strDescription);
129 iRet = PCO_GetRecordingState(this->
cam, &RecordingState);
132 iRet = PCO_SetRecordingState(this->
cam, 0);
135 iRet = PCO_GetDelayExposureTime(this->
cam, &(auxDelay), &(auxExposure), &(auxTimeBaseDelay), &(auxTimeBaseExposure));
147 LOG_ERROR(
"PCO Ultraviolet: SetExposureTime (PCO_SetDelayExposureTime) failed with errorcode " << iRet);
152 iRet = PCO_ArmCamera(this->
cam);
154 iRet = PCO_GetCameraHealthStatus(this->
cam, &CameraWarning, &CameraError, &CameraStatus);
155 if (CameraError != 0)
157 LOG_ERROR(
"PCO Ultraviolet: Camera has error status " << CameraError);
158 iRet = PCO_CloseCamera(this->
cam);
162 strCamType.wSize =
sizeof(PCO_CameraType);
163 iRet = PCO_GetCameraType(this->
cam, &strCamType);
164 if (iRet != PCO_NOERROR)
166 LOG_ERROR(
"PCO Ultraviolet: PCO_GetCameraType failed with errorcode " << iRet);
167 iRet = PCO_CloseCamera(this->
cam);
171 if (strCamType.wInterfaceType == INTERFACE_CAMERALINK)
173 PCO_SC2_CL_TRANSFER_PARAM cl_par;
174 iRet = PCO_GetTransferParameter(this->
cam, (
void*)&cl_par,
sizeof(PCO_SC2_CL_TRANSFER_PARAM));
175 LOG_DEBUG(
"PCO Ultraviolet Camlink Settings: Baudrate=" << cl_par.baudrate <<
", Clockfreq=" << cl_par.ClockFrequency <<
", Dataformat=" << cl_par.DataFormat <<
", Transmit=" << cl_par.Transmit);
178 iRet = PCO_GetSizes(this->
cam, &(this->XResAct), &(this->YResAct), &(this->XResMax), &(this->YResMax));
185 iRet = PCO_SetImageParameters(this->
cam, this->XResAct, this->YResAct, IMAGEPARAMETERS_READ_FROM_SEGMENTS, NULL, 0);
193 iRet = PCO_CloseCamera(this->
cam);
203 if (this->
cam ==
nullptr)
205 LOG_ERROR(
"vtkPlusUltravioletPCOUVCam::InternalUpdate Unable to read date");
209 iRet = PCO_SetRecordingState(this->
cam, 1);
212 if (iRet != PCO_NOERROR)
214 LOG_ERROR(
"vtkPlusUltravioletPCOUVCam::InternalUpdate Unable to receive frame");
221 LOG_ERROR(
"Unable to grab a video source. Skipping frame.");
235 FrameSizeType frameSize = { static_cast<unsigned int>(this->
XResAct), static_cast<unsigned int>(this->
YResAct), 1 };
251 LOG_WARNING(
"vtkPlusUltravioletPCOUVCam is expecting one output channel and there are " << this->
OutputChannels.size() <<
" channels. First output channel will be used.");
256 LOG_ERROR(
"No output channels defined for vtkPlusUltravioletPCOUVCam. Cannot proceed.");
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
#define XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_WRITING(deviceConfig, rootConfigElement)
virtual PlusStatus InternalDisconnect() VTK_OVERRIDE
PlusStatus SetInputFrameSize(unsigned int x, unsigned int y, unsigned int z)
virtual PlusStatus AddItem(vtkImageData *frame, US_IMAGE_ORIENTATION usImageOrientation, US_IMAGE_TYPE imageType, long frameNumber, double unfilteredTimestamp=UNDEFINED_TIMESTAMP, double filteredTimestamp=UNDEFINED_TIMESTAMP, const igsioFieldMapType *customFields=NULL)
bool RequireImageOrientationInConfiguration
PlusStatus SetImageType(US_IMAGE_TYPE imageType)
PlusStatus InternalUpdate()
PlusStatus WriteConfiguration(vtkXMLDataElement *config)
PlusStatus SetPixelType(igsioCommon::VTKScalarPixelType pixelType)
virtual PlusStatus Disconnect()
PlusStatus GetFirstActiveOutputVideoSource(vtkPlusDataSource *&aVideoSource)
unsigned long FrameNumber
PlusStatus ReadConfiguration(vtkXMLDataElement *config)
virtual PlusStatus InternalConnect() VTK_OVERRIDE
Class for interfacing an PCO Ultraviolet capture device and recording frames into a Plus buffer.
virtual PlusStatus Connect()
#define XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_READING(deviceConfig, rootConfigElement)
virtual US_IMAGE_ORIENTATION GetInputImageOrientation()
bool StartThreadForInternalUpdates
PlusStatus FreezeDevice(bool freeze)
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
ChannelContainer OutputChannels
PlusStatus SetNumberOfScalarComponents(unsigned int numberOfScalarComponents)
~vtkPlusUltravioletPCOUVCam()
vtkStandardNewMacro(vtkPlusUltravioletPCOUVCam)
virtual PlusStatus NotifyConfigured()
vtkPlusUltravioletPCOUVCam()
virtual int GetNumberOfItems()
Interface to a 3D positioning tool, video source, or generalized data stream.