45
46
#include <api/controllers/icontroladorcarga.h>
46
47
#include <main/controllers/controladorcarga.h>
47
#include <main/controllers/controladorcomandos.h>
48
#include <main/controllers/commandcontroller.h>
48
49
#include <main/controllers/historycontroller.h>
49
50
#include <main/controllers/hangingprotocolcontroller.h>
50
#include <visualizator/commands/pdfextractercommand.h>
51
#include <commands/pdfextractercommand.h>
51
52
#include <commands/comandopacs.h>
201
202
return (importationUID == EXT_IMPORTER_SID);
206
GNC::GCS::IVista* OpenMedicalImageViewer(const std::set<long>& seriesPk, wxWindow* pParent, GNC::GCS::IEntorno* pEntorno, GNC::GCS::IModuleController* pModule, const GNC::GCS::Ptr<GNC::GCS::Layout>& hangingLayout)
208
wxWindowDisabler disabler;
209
GNC::GCS::Ptr<GNKVisualizator::VisualizatorStudy> estudio = new GNKVisualizator::VisualizatorStudy();
210
estudio->OpenedSeries.insert(estudio->OpenedSeries.begin(), seriesPk.begin(), seriesPk.end());
211
estudio->Module = pModule;
212
estudio->hangingLayout = hangingLayout;
213
estudio->ParentWindow = pParent;
214
estudio->InitializeContext(*seriesPk.begin());
215
GNC::GCS::IVista* pVista = new GNKVisualizator::Vista2D(estudio);
216
pEntorno->GetControladorVistas()->Registrar(pVista);
217
pEntorno->GetControladorCarga()->CargaAsincrona(pVista);
204
221
/* Abre un estudio de manera no interactiva desde un directorio y devuelve su controlador específico */
205
222
GNC::GCS::IVista* GNKVisualizator::ControladorAtencionPrimaria::OpenView(int modo, GNC::GCS::IHistoryController::SeriesModelList& series, GNC::GCS::Ptr<GNC::GCS::HangingProtocol> hangingProtocol)
214
231
//si no se soporta alguna modalidad pues se ignora
215
232
std::set<long> pkSeries;
233
bool wadoLinked = false;
217
235
for(GNC::GCS::IHistoryController::SeriesModelList::iterator it = series.begin(); it!= series.end(); ++it){
218
236
for (GNC::GCS::IHistoryController::StringList::iterator itTsyntax = (*it).tsuids.begin(); itTsyntax != (*it).tsuids.end(); ++itTsyntax) {
219
237
if(m_ListaModos[modo]->SupportsModalityFile((*it).series_modality, (*itTsyntax)))
221
239
pkSeries.insert((*it).pk);
240
if ((*it).location == GNC::GCS::IHistoryController::TL_WadoLinked) {
249
//show dialog then download and open again
250
std::list<long> listOfPk;
251
listOfPk.insert(listOfPk.begin(), pkSeries.begin(), pkSeries.end());
252
GNC::GUI::SynchronizeDialog dlg(m_pEntorno->GetVentanaRaiz(), listOfPk, this, modo, hangingProtocol);
228
257
//first of all open pdf...
229
258
std::set<long> tmpPk = pkSeries;
230
259
pkSeries.clear();
231
260
for(std::set<long>::iterator it = tmpPk.begin(); it!= tmpPk.end(); ++it)
233
GNC::GCS::IHistoryController::FileModelList fileModels;
262
GNC::GCS::IHistoryController::LightFileModelList fileModels;
234
263
GNC::GCS::HistoryController::Instance()->GetSeriesSortedFileModels((*it), fileModels);
235
264
if (fileModels.size() == 0)
251
GNKVisualizator::GADAPI::PDFExtracterCommandParameters* pParams = new GNKVisualizator::GADAPI::PDFExtracterCommandParameters(paths);
252
GNKVisualizator::GADAPI::PDFExtracterCommand* pCmd = new GNKVisualizator::GADAPI::PDFExtracterCommand(pParams);
253
m_pEntorno->GetControladorComandos()->ProcessAsync("Extracting...", pCmd, NULL);
280
GADAPI::PDFExtracterCommandParameters* pParams = new GADAPI::PDFExtracterCommandParameters(paths);
281
GADAPI::PDFExtracterCommand* pCmd = new GADAPI::PDFExtracterCommand(pParams);
282
m_pEntorno->GetCommandController()->ProcessAsync("Extracting...", pCmd, NULL);
256
285
pkSeries.insert((*it));
261
289
GNC::GCS::IControladorVistas* pCtrlVistas = m_pEntorno->GetControladorVistas();
262
290
wxWindow* pVentanaPadre = NULL;
264
292
if (m_ListaModos[modo]->GetDescripcion() == _Std("Medical Image Viewer") && !pkSeries.empty())
266
{//comienza la deshabilitacion
267
pVentanaPadre = pCtrlVistas->GetRootWindow();
268
pCtrlVistas->Freeze();
270
wxWindowDisabler disabler;
271
GNC::GCS::Ptr<GNKVisualizator::VisualizatorStudy> estudio = new GNKVisualizator::VisualizatorStudy();
272
estudio->OpenedSeries.insert(estudio->OpenedSeries.begin(), pkSeries.begin(), pkSeries.end());
273
estudio->Module = this;
274
estudio->hangingProtocol = hangingProtocol;
275
estudio->ParentWindow = pVentanaPadre;
276
estudio->InitializeContext(*pkSeries.begin());
277
pVista = new GNKVisualizator::Vista2D(estudio);
278
pCtrlVistas->Registrar(pVista);
280
catch(GNC::GCS::VistaException &ex){
281
if (pVista != NULL) {
282
pCtrlVistas->Destruir(pVista);
285
wxString mensaje = wxString::FromUTF8(ex.GetCause().c_str());
286
wxMessageDialog dialogo( m_pEntorno->GetVentanaRaiz(), mensaje, _("Error opening study"), wxOK | wxICON_INFORMATION);
291
if (pVista != NULL) {
292
pCtrlVistas->Destruir(pVista);
295
wxMessageDialog dialogo( m_pEntorno->GetVentanaRaiz(), _("Error opening study"), _("Error opening study"), wxOK | wxICON_INFORMATION);
300
}//fin deshabilitacion
301
if (pVista == NULL ) {
302
pCtrlVistas->Freeze();
303
pCtrlVistas->Destruir(pVista);
308
m_pEntorno->GetControladorCarga()->CargaAsincrona(pVista);
294
{//comienza la deshabilitacion
295
pVentanaPadre = pCtrlVistas->GetRootWindow();
296
pCtrlVistas->Freeze();
298
if (hangingProtocol.IsValid() && !hangingProtocol->getLayouts().empty()) {
299
for (GNC::GCS::HangingProtocol::TListOfLayouts::const_iterator it = hangingProtocol->getLayouts().begin(); it != hangingProtocol->getLayouts().end(); ++it)
301
pVista = OpenMedicalImageViewer(pkSeries, pVentanaPadre, m_pEntorno, this, (*it));
304
pVista = OpenMedicalImageViewer(pkSeries, pVentanaPadre, m_pEntorno, this, NULL);
308
catch(GNC::GCS::VistaException &ex){
309
if (pVista != NULL) {
310
pCtrlVistas->Destruir(pVista);
313
wxString mensaje = wxString::FromUTF8(ex.GetCause().c_str());
314
wxMessageDialog dialogo( m_pEntorno->GetVentanaRaiz(), mensaje, _("Error opening study"), wxOK | wxICON_INFORMATION);
319
if (pVista != NULL) {
320
pCtrlVistas->Destruir(pVista);
323
wxMessageDialog dialogo( m_pEntorno->GetVentanaRaiz(), _("Error opening study"), _("Error opening study"), wxOK | wxICON_INFORMATION);
328
}//fin deshabilitacion
311
330
else if (m_ListaModos[modo]->GetDescripcion() == _Std("Waveform viewer") && !pkSeries.empty())