7 #include "PlusConfigure.h" 8 #include "vtkImageData.h" 9 #include "vtkObjectFactory.h" 10 #include "vtkIGSIOTrackedFrameList.h" 14 #include "vtkIGSIOTransformRepository.h" 24 , LastProcessedTrackingDataTimestamp(0)
28 vtkSmartPointer<vtkPlusUsSimulatorAlgo> usSimulator = vtkSmartPointer<vtkPlusUsSimulatorAlgo>::New();
32 vtkSmartPointer<vtkIGSIOTransformRepository> transformRepository = vtkSmartPointer<vtkIGSIOTransformRepository>::New();
65 LOG_ERROR(
"vtkPlusUsSimulatorVideoSource device requires exactly 1 input stream (that contains the tracking data). Check configuration.");
75 vtkSmartPointer<vtkIGSIOTrackedFrameList> trackingFrames = vtkSmartPointer<vtkIGSIOTrackedFrameList>::New();
78 LOG_DEBUG(
"Simulated US image is not generated, as no tracking data is available yet. Device ID: " << this->
GetDeviceId());
81 double oldestTrackingTimestamp(0);
86 LOG_INFO(
"Simulated US image generation started. No tracking data was available between " << this->
LastProcessedTrackingDataTimestamp <<
"-" << oldestTrackingTimestamp <<
87 "sec, therefore no simulated images were generated during this time period.");
97 if (trackingFrames->GetNumberOfTrackedFrames() < 1)
99 LOG_DYNAMIC(
"Simulated US image generation is skipped, as as no updated tracking data has become available since the last generated image (at " << this->
LastProcessedTrackingDataTimestamp <<
"). Probably the tracker device acquisition rate is lower than the simulator acquisition rate. Device ID: " << this->
GetDeviceId(), this->
GracePeriodLogLevel);
102 igsioTrackedFrame* trackedFrame = trackingFrames->GetTrackedFrame(0);
103 if (trackedFrame == NULL)
110 double latestTrackerTimestamp = trackedFrame->GetTimestamp();
114 LOG_ERROR(
"No output channels defined");
118 double latestFrameAlreadyAddedTimestamp = 0;
120 if (latestFrameAlreadyAddedTimestamp >= latestTrackerTimestamp)
122 LOG_DEBUG(
"Simulated frame has been already generated for timestamp: " << latestFrameAlreadyAddedTimestamp);
132 LOG_ERROR(
"Failed to set repository transforms from tracked frame!");
143 LOG_ERROR(
"Unable to retrieve the video source in the USSimulator device.");
147 LOG_DEBUG(
"Simulated frame " << this->
FrameNumber <<
" generated.");
158 LOG_TRACE(
"vtkPlusUsSimulatorVideoSource::InternalConnect");
162 LOG_ERROR(
"No output channels defined");
170 LOG_ERROR(
"Unable to retrieve the video source in the USSimulator device.");
177 FrameSizeType frameSize = {0, 0, 1};
180 LOG_ERROR(
"Failed to initialize buffer, frame size is unknown");
194 if (linearScanConverter)
198 else if (curvilinearScanConverter)
227 LOG_TRACE(
"vtkPlusUsSimulatorVideoSource::ReadConfiguration");
234 LOG_ERROR(
"Failed to read US simulator configuration!");
242 LOG_ERROR(
"Failed to read transform repository configuration!");
254 LOG_WARNING(
"vtkPlusUsSimulatorVideoSource is expecting one output channel and there are " << this->
OutputChannels.size() <<
" channels. First output channel will be used.");
259 LOG_ERROR(
"No output channels defined for vtkPlusUsSimulatorVideoSource. Cannot proceed.");
276 if (linearScanConverter)
280 else if (curvilinearScanConverter)
vtkPlusUsSimulatorVideoSource()
virtual void SetBrightnessConversionGamma(double)
virtual double GetRadiusStartMm()
bool IsPending(const std::string ¶mName) const
virtual PlusStatus SetOutputImageOrientation(US_IMAGE_ORIENTATION imageOrientation)
virtual vtkIGSIOTransformRepository * GetTransformRepository()
static const char * KEY_DEPTH
static vtkPlusUsScanConvertCurvilinear * SafeDownCast(vtkObject *o)
static const char * KEY_FREQUENCY
Class to abstract away specific sequence file read/write details.
virtual void SetImagingDepthMm(double)
ChannelContainer InputChannels
PlusStatus SetContrast(double aContrast)
PlusStatus GetDepthMm(double &aDepthMm) const
virtual vtkPlusUsScanConvert * GetScanConverter()
virtual PlusStatus NotifyConfigured()
virtual std::string GetDeviceId() const
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)
virtual double GetRadiusStopMm()
vtkPlusUsImagingParameters * ImagingParameters
Store the current imaging parameters.
bool RequireImageOrientationInConfiguration
virtual void SetRadiusStopMm(double)
PlusStatus SetPending(const std::string ¶mName, bool pending)
virtual void SetTransformRepository(vtkIGSIOTransformRepository *)
virtual PlusStatus InternalApplyImagingParameterChange()
virtual void SetUsSimulator(vtkPlusUsSimulatorAlgo *)
static const char * KEY_INTENSITY
virtual PlusStatus Disconnect()
virtual void SetIncomingIntensityMwPerCm2(double)
virtual PlusStatus InternalConnect()
virtual void SetCorrectlyConfigured(bool)
double LastProcessedTrackingDataTimestamp
unsigned long FrameNumber
vtkStandardNewMacro(vtkPlusUsSimulatorVideoSource)
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual PlusStatus GetMostRecentTimestamp(double &ts)
virtual double GetImagingDepthMm()
PlusStatus GetContrast(double &aContrast) const
#define XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_READING(deviceConfig, rootConfigElement)
virtual double GetBrightnessConversionGamma()
virtual double GetIncomingIntensityMwPerCm2()
static const char * KEY_CONTRAST
virtual vtkPlusUsSimulatorAlgo * GetUsSimulator()
vtkPlusUsSimulatorAlgo * UsSimulator
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *config)
virtual US_IMAGE_ORIENTATION GetInputImageOrientation()
bool StartThreadForInternalUpdates
Class for providing VTK video input interface from simulated ultrasound.
This class performs scan conversion from scan lines for curvilinear probes.
bool HasGracePeriodExpired()
virtual double GetFrequencyMhz()
PlusStatus SetIntensity(double aIntensity)
Contains an optional timestamped circular buffer containing the video images and a number of timestam...
PlusStatus SetFrequencyMhz(double aFrequencyMhz)
ChannelContainer OutputChannels
PlusStatus GetFrequencyMhz(double &aFrequencyMhz) const
This is a base class for defining a common scan conversion algorithm interface for all kinds of probe...
This class performs scan conversion from scan lines for curvilinear probes.
PlusStatus GetIntensity(double &aIntensity) const
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual ~vtkPlusUsSimulatorVideoSource()
virtual void SetFrequencyMhz(double)
bool IsSet(const std::string ¶mName) const
virtual PlusStatus InternalUpdate()
static vtkPlusUsScanConvertLinear * SafeDownCast(vtkObject *o)
PlusStatus GetVideoSource(vtkPlusDataSource *&aVideoSource) const
virtual vtkPlusRfProcessor * GetRfProcessor()
PlusStatus SetDepthMm(double aDepthMm)
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *config)
vtkPlusLogger::LogLevelType GracePeriodLogLevel
virtual PlusStatus InternalDisconnect()
PlusStatus GetFrameSize(FrameSizeType &frameSize)
Interface to a 3D positioning tool, video source, or generalized data stream.