7 #include "PlusConfigure.h" 60 LOG_TRACE(
"vtkPlusUsImagingParameters::~vtkPlusUsImagingParameters()");
86 return this->SetValue<double>(
KEY_DEPTH, aDepthMm);
92 return this->GetValue<double>(
KEY_DEPTH, aDepthMm);
99 this->GetValue<double>(
KEY_DEPTH, aValue);
126 return this->SetValue<double>(
KEY_GAIN, aGainPercent);
132 return this->GetValue<double>(
KEY_GAIN, aGainPercent);
139 this->GetValue<double>(
KEY_GAIN, aValue);
146 std::stringstream result;
147 std::copy(tgc.begin(), tgc.end(), std::ostream_iterator<double>(result,
" "));
162 std::vector<double> tgcVec(tgc, tgc + length);
170 if (keyIt != this->
Parameters.end() && keyIt->second.Set ==
false)
179 std::stringstream ss;
181 ss.str(it->second.Value);
182 std::vector<double> numbers((std::istream_iterator<double>(ss)), std::istream_iterator<double>());
190 std::vector<double> vec;
238 return this->SetValue<double>(
KEY_POWER, aPower);
244 return this->GetValue<double>(
KEY_POWER, aPower);
251 this->GetValue<double>(
KEY_POWER, aValue);
258 return this->SetValue<double>(
KEY_DYNRANGE, aDynRangeDb);
264 return this->GetValue<double>(
KEY_DYNRANGE, aDynRangeDb);
278 return this->SetValue<double>(
KEY_ZOOM, aZoomFactor);
284 return this->GetValue<double>(
KEY_ZOOM, aZoomFactor);
291 this->GetValue<double>(
KEY_ZOOM, aValue);
298 return this->SetValue<double>(
KEY_SECTOR, aSectorPercent);
304 return this->GetValue<double>(
KEY_SECTOR, aSectorPercent);
351 return this->SetValue<float>(
KEY_VOLTAGE, aVoltage);
357 return this->GetValue<float>(
KEY_VOLTAGE, aVoltage);
371 std::stringstream result;
372 std::copy(imageSize.begin(), imageSize.end(), std::ostream_iterator<double>(result,
" "));
388 FrameSizeType imageSize = {
x,
y, z };
396 if (keyIt != this->
Parameters.end() && keyIt->second.Set ==
false)
405 std::stringstream ss;
407 ss.str(it->second.Value);
408 std::vector<unsigned int> numbers((std::istream_iterator<unsigned int>(ss)), std::istream_iterator<unsigned int>());
410 imageSize[0] = numbers[0];
411 if (numbers.size() > 1)
413 imageSize[1] = numbers[1];
415 if (numbers.size() > 2)
417 imageSize[2] = numbers[2];
429 FrameSizeType imageSize;
437 Superclass::PrintSelf(os, indent);
441 if (it->second.Set ==
true)
443 os << indent << it->first <<
": " << it->second.Value
444 << (it->second.Pending ?
" (pending)" :
"") << std::endl;
452 vtkXMLDataElement* parameterList(NULL);
453 for (
int i = 0;
i < deviceConfig->GetNumberOfNestedElements(); ++
i)
455 vtkXMLDataElement* element = deviceConfig->GetNestedElement(
i);
458 parameterList = element;
463 if (parameterList == NULL)
465 LOG_ERROR(
"Unable to locate UsImagingParameters tag in device config. Unable to read imaging parameters. Device defaults will probably be used.");
469 for (
int i = 0;
i < parameterList->GetNumberOfNestedElements(); ++
i)
471 vtkXMLDataElement* element = parameterList->GetNestedElement(
i);
472 std::string name = element->GetAttribute(
NAME_TAG) ? element->GetAttribute(
NAME_TAG) :
"";
504 XML_FIND_NESTED_ELEMENT_CREATE_IF_MISSING(parameterList, deviceConfig,
XML_ELEMENT_TAG);
507 parameterList->RemoveAllNestedElements();
511 if (it->second.Set ==
false)
517 vtkSmartPointer<vtkXMLDataElement> parameter = vtkSmartPointer<vtkXMLDataElement>::New();
519 parameter->SetAttribute(
NAME_TAG, it->first.c_str());
520 parameter->SetAttribute(
VALUE_TAG, it->second.Value.c_str());
522 parameterList->AddNestedElement(parameter);
534 return keyIt->second.Set;
537 LOG_ERROR(
"Invalid key request sent to vtkPlusUsImagingParameters::IsSet -- " << paramName);
547 return keyIt->second.Pending;
550 LOG_ERROR(
"Invalid key request sent to vtkPlusUsImagingParameters::IsPending -- " << paramName);
560 if (keyIt->second.Set)
562 keyIt->second.Pending = pending;
567 LOG_ERROR(
"Pending status cannot be set for unset parameter -- " << paramName);
572 LOG_ERROR(
"Invalid key request sent to vtkPlusUsImagingParameters::SetPending -- " << paramName);
581 if (this->
Parameters[it->first].Value != it->second.Value)
586 this->
Parameters[it->first].Value = it->second.Value;
587 this->
Parameters[it->first].Set = it->second.Set;
static const char * KEY_DYNRANGE
double GetGainPercent() const
double GetFrequencyMhz() const
ParameterMap::const_iterator ParameterMapConstIterator
static const char * KEY_IMAGESIZE
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *deviceConfig)
ParameterMap::iterator ParameterMapIterator
bool IsPending(const std::string ¶mName) const
double GetContrast() const
static const char * KEY_DEPTH
This class is used to store a configuration of the imaging parameters of an ultrasound video device....
static const char * KEY_FOCUS_DEPTH
static const char * KEY_FREQUENCY
double GetSectorPercent() const
PlusStatus SetContrast(double aContrast)
double GetFocusDepthPercent() const
vtkPlusUsImagingParameters()
static const char * NAME_TAG
PlusStatus SetPending(const std::string ¶mName, bool pending)
double GetDepthMm() const
static const char * KEY_GAIN
ParameterMapConstIterator begin() const
PlusStatus SetTimeGainCompensation(const std::vector< double > &tgc)
vtkStandardNewMacro(vtkPlusUsImagingParameters)
static const char * KEY_INTENSITY
PlusStatus SetPowerDb(double aPower)
float GetSoundVelocity() const
PlusStatus SetProbeVoltage(float aVoltage)
PlusStatus SetGainPercent(double aGainPercent)
static const char * KEY_SECTOR
static const char * KEY_POWER
PlusStatus SetImageSize(const FrameSizeType &imageSize)
virtual ~vtkPlusUsImagingParameters()
PlusStatus SetDynRangeDb(double aDynRangeDb)
PlusStatus SetSectorPercent(double aSectorPercent)
static const char * KEY_CONTRAST
double GetIntensity() const
FrameSizeType GetImageSize() const
float GetProbeVoltage() const
static const char * KEY_SOUNDVELOCITY
double GetPowerDb() const
static const char * KEY_VOLTAGE
double GetZoomFactor() const
const char const char * value
static const char * KEY_ZOOM
static const char * US_PARAMETER_TAG
std::vector< double > GetTimeGainCompensation() const
PlusStatus SetIntensity(double aIntensity)
PlusStatus SetFrequencyMhz(double aFrequencyMhz)
PlusStatus SetFocusDepthPercent(double aFocusDepthPercent)
Direction vectors of rods y
PlusStatus SetZoomFactor(double aZoomFactor)
double GetDynRangeDb() const
bool IsSet(const std::string ¶mName) const
static const char * VALUE_TAG
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
PlusStatus SetDepthMm(double aDepthMm)
PlusStatus SetSoundVelocity(float aSoundVelocity)
virtual PlusStatus DeepCopy(const vtkPlusUsImagingParameters &otherParameters)
static const char * KEY_TGC
static const char * XML_ELEMENT_TAG
ParameterMapConstIterator end() const
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *deviceConfig)