69 if (index >= m_ProbesSet.size())
71 MITK_ERROR(
"USTelemedProbesControls")(
"USControlInterfaceProbes")
72 <<
"Cannot select probe with index " << index <<
". Maximum possible index is " << m_ProbesSet.size()-1 <<
".";
73 mitkThrow() <<
"Cannot select probe with index " << index <<
74 ". Maximum possible index is " << m_ProbesSet.size()-1 <<
".";
77 m_TelemedDevice->SetActiveDataView(m_ProbesSet.at(index)->GetUsgDataView());
79 m_SelectedProbeIndex = index;
88 if (m_SelectedProbeIndex >= m_ProbesSet.size())
90 MITK_ERROR(
"USTelemedProbesControls")(
"USControlInterfaceProbes")
91 <<
"Cannot get active probe as the current index is" << m_SelectedProbeIndex <<
92 ". Maximum possible index is " << m_ProbesSet.size()-1 <<
".";
93 mitkThrow() <<
"Cannot get active probe as the current index is" << m_SelectedProbeIndex <<
94 ". Maximum possible index is " << m_ProbesSet.size()-1 <<
".";
97 return m_ProbesSet.at(m_SelectedProbeIndex).GetPointer();
136 IUnknown* tmp_obj =
nullptr;
140 Usgfw2Lib::IUsgfw2* usgMainInterface = m_TelemedDevice->GetUsgMainInterface();
141 if ( ! usgMainInterface )
143 MITK_ERROR(
"USTelemedProbesControls")(
"USControlInterfaceProbes")
144 <<
"Main interface of Telemed device must not be null.";
145 mitkThrow() <<
"Main interface of Telemed device must not be null.";
149 hr = usgMainInterface->get_ProbesCollection(&tmp_obj);
150 if (FAILED(hr) || ! tmp_obj)
152 MITK_WARN(
"USTelemedProbesControls")(
"USControlInterfaceProbes")
153 <<
"Error on getting probes collection (" << hr <<
").";
159 hr = tmp_obj->QueryInterface(Usgfw2Lib::IID_IUsgCollection,(
void**)&m_ProbesCollection);
161 if (FAILED(hr) || ! m_ProbesCollection)
163 MITK_WARN(
"USTelemedProbesControls")(
"USControlInterfaceProbes")
164 <<
"Error on querying interface for probes collection (" << hr <<
").";
173 if ( ! m_ProbesCollection)
175 MITK_ERROR(
"USTelemedProbesControls")(
"USControlInterfaceProbes")
176 <<
"Cannot get probe set without ProbesCollection being initialized before.";
177 mitkThrow() <<
"Cannot get probe set without ProbesCollection being initialized before.";
181 LONG probes_count = 0;
182 HRESULT hr = m_ProbesCollection->get_Count(&probes_count);
183 if (FAILED(hr)) { mitkThrow() <<
"Could not get probes count (" << hr <<
")."; }
185 if ( ! m_TelemedDevice )
187 MITK_ERROR(
"USTelemedProbesControls")(
"USControlInterfaceProbes")
188 <<
"Telemed device must not be null when creating probes set.";
189 mitkThrow() <<
"Telemed device must not be null when creating probes set.";
193 Usgfw2Lib::IUsgfw2* usgMainInterface = m_TelemedDevice->GetUsgMainInterface();
194 if ( ! usgMainInterface )
196 MITK_ERROR(
"USTelemedProbesControls")(
"USControlInterfaceProbes")
197 <<
"Usg main interface must not be null when creating probes set.";
198 mitkThrow() <<
"Usg main interface must not be null when creating probes set.";
202 m_ProbesSet = std::vector<mitk::USTelemedProbe::Pointer>();
204 for (LONG n = 0; n < probes_count; ++n)
207 IUnknown* tmp_obj =
nullptr;
208 hr = m_ProbesCollection->Item(n,&tmp_obj);
211 MITK_ERROR(
"USTelemedProbesControls")(
"USControlInterfaceProbes")
212 <<
"Could not get probe with index " << n <<
".";
213 mitkThrow() <<
"Could not get probe with index " << n <<
".";
217 Usgfw2Lib::IProbe* probe;
218 hr = tmp_obj->QueryInterface(Usgfw2Lib::IID_IProbe,(
void**)&probe);
221 MITK_ERROR(
"USTelemedProbesControls")(
"USControlInterfaceProbes")
222 <<
"Error on querying interface for probe with index "<< n <<
".";
223 mitkThrow() <<
"Error on querying interface for probe with index "<< n <<
".";
227 Usgfw2Lib::IUsgDataView* usgDataView;
228 Usgfw2Lib::IUsgDataViewPtr usgDataViewTmp;
229 usgDataViewTmp = usgMainInterface->CreateDataView(probe);
230 usgDataViewTmp->QueryInterface(Usgfw2Lib::IID_IUsgDataView, (
void**)&usgDataView);
233 MITK_ERROR(
"USTelemedProbesControls")(
"USControlInterfaceProbes")
234 <<
"Could not create data view for selected probe.";
235 mitkThrow() <<
"Could not create data view for selected probe.";
239 m_ProbesSet.push_back(mitk::USTelemedProbe::New(probe, usgDataView));