예제 #1
0
BetProcedureFrame::BetProcedureFrame(wxWindow* parent, const Patient& patient) :
		BaseProcedureFrame(parent), currents_graphic_(
				wxBitmap(wxT("graphic_small"), wxBITMAP_TYPE_PNG_RESOURCE).ConvertToImage(), 20, 15, 680, 120,
				DURATION_LIMIT + 30 * 60, //30min. for closing procedure
				80,
				{ wxColor(13, 193, 184), wxColor(0, 0, 255), wxColor(125, 0, 255), wxColor(255, 0, 0), wxColor(255, 125,
						0), wxColor(80, 170, 80) }), voltage_graphic_(
				wxBitmap(wxT("graphic_big"), wxBITMAP_TYPE_PNG_RESOURCE).ConvertToImage(), 26, 15, 674, 240,
				DURATION_LIMIT + 30 * 60, 120, { wxColor(0, 0, 225),
				wxColor(125, 0, 0),
				wxColor(0, 125, 0), wxColor(125, 0, 125) }), lightR_(wxT("lightr"), wxBITMAP_TYPE_PNG_RESOURCE), lightG_(
				wxT("lightg"), wxBITMAP_TYPE_PNG_RESOURCE), lightS_(wxT("lights"), wxBITMAP_TYPE_PNG_RESOURCE), switch1_(
		SW_OFF), switch2_(SW_OFF), switch3_(SW_OFF), switch4_(SW_OFF), switch5_(SW_OFF), switch6_(
		SW_OFF), cable_(CABLE_OUT), key_(KEY_ON), polarity_(false), voltage_(0), decrease_speed_(0.1), time_to_end_(60), q_(
				0), duration_(0), state_(
		STATE_INITIAL), conf_channel_alarm_wait_(10){
	for (int i = 0; i < 7; i++) {
		voltages_[i] = 0;
		currents_[i] = 0;
	}
	patient_id_ = patient.getPatientNumber();
	m_txtPatientName->SetLabel(patient.getFullName());
	m_txtTreatmentNumber->SetLabel(wxString::Format("%i", patient.getTreatmentCount() + 1));
	m_bmpElectrodes->SetBitmap(currents_graphic_.getImage());
	m_bmpVoltage->SetBitmap(voltage_graphic_.getImage());
	my_timer_.SetOwner(this);
	m_bmpInd1->SetBitmap(lightS_);
	m_bmpInd2->SetBitmap(lightS_);
	m_bmpInd3->SetBitmap(lightS_);
	m_bmpInd4->SetBitmap(lightS_);
	m_bmpInd5->SetBitmap(lightS_);
	m_bmpInd6->SetBitmap(lightS_);
	updateFloatValue(voltage_, m_txtVoltage);
	updateIntegerValue(0, m_txtCurrent);
	updateDurationValue(time_to_end_, m_txtDuration);
	parseOptions();
	Bind(wxEVT_TIMER, &BetProcedureFrame::OnTimer, this);

	if (options_.find(std::string("port")) == options_.end() )
		throw std::runtime_error("port not specified in configuration file");
	protocol_.start(options_[std::string("port")].as<std::string>());
	decrease_speed_ = options_[std::string("decrease_speed")].as<float>();
	regulator_speed_ = options_[std::string("regulator_speed")].as<float>();
	conf_channel_alarm_wait_ = options_[std::string("channel_alarm_wait")].as<unsigned int>();
	Bind(wxEVT_KEY_DOWN, &BetProcedureFrame::OnKeyEvent, this, wxID_ANY);
	DoGoInInitialState();
	my_timer_.Start(1000);
	wxGetApp().setProcedureFrame(this);
}
void QInputOutputDicomdirWidget::view()
{
    QList<QPair<DicomMask, DICOMSource> > selectedDICOMITems = m_studyTreeWidget->getDicomMaskOfSelectedItems();
    DicomMask patientToProcessMask;
    Patient *patient;
    QList<Patient*> selectedPatientsList;

    if (selectedDICOMITems.isEmpty())
    {
        QMessageBox::warning(this, ApplicationNameString, tr("Select at least one study to view."));
        return;
    }

    QApplication::setOverrideCursor(Qt::WaitCursor);
    for (int index = 0; index < selectedDICOMITems.count(); index++)
    {
        patientToProcessMask.setStudyInstanceUID(selectedDICOMITems.at(index).first.getStudyInstanceUID());
        patient = m_readDicomdir.retrieve(patientToProcessMask);

        if (patient)
        {
            patient->setSelectedSeries(selectedDICOMITems.at(index).first.getSeriesInstanceUID());
            selectedPatientsList << patient;
        }
        else
        {
            DEBUG_LOG("No s'ha pogut obtenir l'estudi amb UID " + selectedDICOMITems.at(index).first.getStudyInstanceUID());
        }
    }

    QApplication::restoreOverrideCursor();

    if (!selectedPatientsList.isEmpty())
    {
        DEBUG_LOG("Llançat signal per visualitzar estudi del pacient " + patient->getFullName());
        emit viewPatients(selectedPatientsList);
    }
    else
    {
        QMessageBox::warning(this, ApplicationNameString, tr("No valid data found. Maybe some files are missing or corrupted."));
    }
}