8 #include "PlusConfigure.h" 14 #include <igsioVideoFrame.h> 15 #include <vtkIGSIOTrackedFrameList.h> 18 #include <vtkImageData.h> 19 #include <vtkObjectFactory.h> 29 return "HorizontalInterlace";
31 return "VerticalInterlace";
40 if (igsioCommon::IsEqualInsensitive(
mode,
"HorizontalInterlace"))
44 else if (igsioCommon::IsEqualInsensitive(
mode,
"VerticalInterlace"))
61 , Mode(Stereo_Unknown)
63 , LastInputTimestamp(UNDEFINED_TIMESTAMP)
64 , FrameList(vtkIGSIOTrackedFrameList::New())
65 , InputSource(nullptr)
68 , SwitchInterlaceOrdering(false)
102 XML_READ_STRING_ATTRIBUTE_NONMEMBER_REQUIRED(
StereoMode, modeStr, deviceConfig);
106 LOG_ERROR(
"Unknown stereo mode in configuration. Please double check.");
121 deviceConfig->SetAttribute(
"StereoMode", ModeToString(this->
Mode).c_str());
136 if (size[1] % 2 == 1)
138 LOG_WARNING(
"Odd sized Y dimension, extra row will be added.");
141 size[1] = std::ceil(size[1] / 2.0);
145 if (size[01] % 2 == 1)
147 LOG_WARNING(
"Odd sized X dimension, extra column will be lost.");
150 size[0] = std::ceil(size[0] / 2.0);
165 this->
LeftImage->SetDimensions(size[0], size[1], size[2]);
166 this->
RightImage->SetDimensions(size[0], size[1], size[2]);
201 vtkImageData* inputImage = frame->GetImageData()->GetImage();
202 vtkIdType* inputIncrements = inputImage->GetIncrements();
203 unsigned char* inputPtr = (
unsigned char*)inputImage->GetScalarPointer();
204 unsigned char* leftPtr = (
unsigned char*)this->
LeftImage->GetScalarPointer();
205 unsigned char* rightPtr = (
unsigned char*)this->
RightImage->GetScalarPointer();
206 vtkIdType* outputIncrements = this->
LeftImage->GetIncrements();
209 for (vtkIdType row = 0; row < inputImage->GetDimensions()[1]; row++)
227 memcpy(leftPtr, inputPtr, inputIncrements[1]);
228 leftPtr += outputIncrements[1];
232 memcpy(rightPtr, inputPtr, inputIncrements[1]);
233 rightPtr += outputIncrements[1];
235 inputPtr += inputIncrements[1];
261 LOG_ERROR(
"Deinterlacer requires exactly 1 input channel");
267 LOG_ERROR(
"Input channel does not have a video source. It is required.");
273 LOG_ERROR(
"Deinterlacer requires at least 2 output channels.");
279 LOG_ERROR(
"Deinterlacer requires exactly 2 video sources named \"Left\" and \"Right\"");
284 LOG_ERROR(
"No video source with ID \"Left\" found.");
290 LOG_ERROR(
"No video source with ID \"Right\" found.");
297 if (!(*it)->HasVideoSource())
299 LOG_ERROR(
"All output channels require a video source.");
vtkPlusDataSource * RightSource
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
vtkPlusDataSource * LeftSource
Abstract interface for tracker and video devices.
US_IMAGE_TYPE GetImageType()
virtual ~vtkPlusVirtualDeinterlacer()
void SplitFrameVertical(igsioTrackedFrame *frame)
#define XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_WRITING(deviceConfig, rootConfigElement)
bool SwitchInterlaceOrdering
ChannelContainer InputChannels
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)
DataSourceContainer VideoSources
virtual unsigned int GetNumberOfScalarComponents()
PlusStatus SetImageType(US_IMAGE_TYPE imageType)
virtual double GetAcquisitionRate() const
double LastInputTimestamp
virtual PlusStatus SetInputImageOrientation(US_IMAGE_ORIENTATION imageOrientation)
PlusStatus SetPixelType(igsioCommon::VTKScalarPixelType pixelType)
virtual double GetAcquisitionRate() const
virtual igsioCommon::VTKScalarPixelType GetPixelType()
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
unsigned long FrameNumber
vtkImageData * RightImage
vtkIGSIOTrackedFrameList * FrameList
virtual PlusStatus NotifyConfigured()
vtkStandardNewMacro(vtkPlusVirtualDeinterlacer)
vtkPlusDataSource * InputSource
vtkPlusVirtualDeinterlacer()
#define XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_READING(deviceConfig, rootConfigElement)
virtual PlusStatus InternalUpdate()
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *)
virtual US_IMAGE_ORIENTATION GetInputImageOrientation()
bool StartThreadForInternalUpdates
vtkPlusDevice * GetDevice()
virtual FrameSizeType GetOutputFrameSize() const
ChannelContainer OutputChannels
PlusStatus SetNumberOfScalarComponents(unsigned int numberOfScalarComponents)
ChannelContainer::iterator ChannelContainerIterator
void SplitFrameHorizontal(igsioTrackedFrame *frame)
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *)