Esempio n. 1
0
        public List <string> GetPatients()
        {
            var patients = new List <string>();

            gdcm.ERootType             typ    = gdcm.ERootType.ePatientRootType;
            gdcm.EQueryLevel           poziom = gdcm.EQueryLevel.ePatient;
            gdcm.KeyValuePairArrayType klucze = new gdcm.KeyValuePairArrayType();

            gdcm.Tag tag = new gdcm.Tag(0x0010, 0x0010);
            gdcm.KeyValuePairType klucz1 = new gdcm.KeyValuePairType(tag, "*");
            klucze.Add(klucz1);
            klucze.Add(new gdcm.KeyValuePairType(new gdcm.Tag(0x0010, 0x0020), ""));
            gdcm.BaseRootQuery zapytanie = gdcm.CompositeNetworkFunctions.ConstructQuery(typ, poziom, klucze);

            // sprawdź, czy zapytanie spełnia kryteria
            if (!zapytanie.ValidateQuery())
            {
                return(null);
            }

            // kontener na wyniki
            gdcm.DataSetArrayType wynik = new gdcm.DataSetArrayType();

            bool stan = gdcm.CompositeNetworkFunctions.CFind(
                this.pacsConfiguration.ipPACS,
                this.pacsConfiguration.portPACS,
                zapytanie,
                wynik,
                this.pacsConfiguration.myAET,
                this.pacsConfiguration.callAET);

            // sprawdź stan
            if (!stan)
            {
                return(null);
            }

            // pokaż wyniki
            foreach (gdcm.DataSet x in wynik)
            {
                // jeden element pary klucz-wartość
                gdcm.DataElement de = x.GetDataElement(new gdcm.Tag(0x0010, 0x0020)); // konkretnie 10,20 = PATIENT_ID

                gdcm.Value val = de.GetValue();
                string     str = val.toString();
                patients.Add(str);
            }
            return(patients);
        }
Esempio n. 2
0
        private void OnRefresh(object obj)
        {
            PatientList.Clear();
            // typ wyszukiwania (rozpoczynamy od pacjenta)
            gdcm.ERootType typ = gdcm.ERootType.ePatientRootType;

            // do jakiego poziomu wyszukujemy
            gdcm.EQueryLevel poziom = gdcm.EQueryLevel.ePatient; // zobacz inne

            // klucze (filtrowanie lub okreœlenie, które dane s¹ potrzebne)
            gdcm.KeyValuePairArrayType klucze = new gdcm.KeyValuePairArrayType();
            //gdcm.Tag tag = new gdcm.Tag(0x0010, 0x0010);
            gdcm.KeyValuePairType klucz1 = new gdcm.KeyValuePairType(new gdcm.Tag(0x0010, 0x0010), "*");
            klucze.Add(klucz1);
            klucze.Add(new gdcm.KeyValuePairType(new gdcm.Tag(0x0010, 0x0020), ""));

            // skonstruuj zapytanie
            gdcm.BaseRootQuery zapytanie = gdcm.CompositeNetworkFunctions.ConstructQuery(typ, poziom, klucze);

            // sprawdŸ, czy zapytanie spe³nia kryteria
            if (!zapytanie.ValidateQuery())
            {
                State = "B³êdne zapytanie";
                return;
            }

            // wykonaj zapytanie
            gdcm.DataSetArrayType wynik = new gdcm.DataSetArrayType();
            bool stan = gdcm.CompositeNetworkFunctions.CFind(IP, ushort.Parse(Port), zapytanie, wynik, AET, "ARCHIWUM");

            // sprawdŸ stan
            if (!stan)
            {
                State = "Nie dzia³a";
                return;
            }

            // poka¿ wyniki
            foreach (gdcm.DataSet x in wynik)
            {
                // jeden element pary klucz-wartoϾ
                gdcm.DataElement de = x.GetDataElement(new gdcm.Tag(0x0010, 0x0020)); // konkretnie 10,20 = PATIENT_ID

                // dostêp jako string
                gdcm.Value val = de.GetValue();  // pobierz wartoϾ dla wskazanego klucza...
                string     str = val.toString(); // ...jako napis
                PatientList.Add(str);
            }
        }
Esempio n. 3
0
        public static List <string> GetPatients(string ip, ushort port, string aet, string call)
        {
            gdcm.ERootType type = gdcm.ERootType.ePatientRootType;

            gdcm.EQueryLevel level = gdcm.EQueryLevel.ePatient;

            gdcm.KeyValuePairArrayType keys = new gdcm.KeyValuePairArrayType();
            gdcm.KeyValuePairType      key  = new gdcm.KeyValuePairType(new gdcm.Tag(0x0010, 0x0010), "*");
            keys.Add(key);

            gdcm.BaseRootQuery query = gdcm.CompositeNetworkFunctions.ConstructQuery(type, level, keys);

            gdcm.DataSetArrayType dataArray = new gdcm.DataSetArrayType();

            //bool status = gdcm.CompositeNetworkFunctions.CFind(ip, port, query, dataArray, aet, call);

            foreach (gdcm.DataSet x in dataArray)
            {
                patientList.Add(x.GetDataElement(new gdcm.Tag(0x0010, 0x0010)).GetValue().toString());
            }

            return(patientList);
        }
Esempio n. 4
0
        public static string Find()
        {
            string resultString = "";

            //FIND

            // typ wyszukiwania (rozpoczynamy od pacjenta)
            gdcm.ERootType typ = gdcm.ERootType.ePatientRootType;

            // do jakiego poziomu wyszukujemy
            gdcm.EQueryLevel poziom = gdcm.EQueryLevel.ePatient; // zobacz tez inne

            // klucze (filtrowanie lub określenie, które dane są potrzebne)
            gdcm.KeyValuePairArrayType klucze = new gdcm.KeyValuePairArrayType();

            gdcm.Tag tag = new gdcm.Tag(0x0010, 0x0010);                        // 10,10 == PATIENT_NAME
            gdcm.KeyValuePairType klucz1 = new gdcm.KeyValuePairType(tag, "*"); // * == dowolne imię
            klucze.Add(klucz1);
            klucze.Add(new gdcm.KeyValuePairType(new gdcm.Tag(0x0010, 0x0020), ""));
            // zwrotnie oczekujemy wypełnionego 10,20 czyli PATIENT_ID

            // skonstruuj zapytanie
            gdcm.BaseRootQuery zapytanie = gdcm.CompositeNetworkFunctions.ConstructQuery(typ, poziom, klucze);

            // sprawdź, czy zapytanie spełnia kryteria
            if (!zapytanie.ValidateQuery())
            {
                return("FIND błędne zapytanie!");
            }

            // kontener na wyniki
            gdcm.DataSetArrayType wynik = new gdcm.DataSetArrayType();

            // wykonaj zapytanie
            bool stan = gdcm.CompositeNetworkFunctions.CFind(ipPACS, portPACS, zapytanie, wynik, myAET, callAET);

            // sprawdź stan
            if (!stan)
            {
                return("FIND nie działa!");
            }

            resultString += "FIND działa.";

            // pokaż wyniki
            foreach (gdcm.DataSet x in wynik)
            {
                resultString += x.toString(); // cała odpowiedź jako wielolinijkowy napis
                // UWAGA: toString() vs ToString() !!!

                // + DOSTEP DO METADANYCH
                //for (var iter = x.Begin(); iter != x.End(); ++iter) { } // brak wrapowania iteratorów...

                // jeden element pary klucz-wartość
                gdcm.DataElement de = x.GetDataElement(new gdcm.Tag(0x0010, 0x0020)); // konkretnie 10,20 = PATIENT_ID

                // dostęp jako string
                gdcm.Value val = de.GetValue();  // pobierz wartość dla wskazanego klucza...
                string     str = val.toString(); // ...jako napis
                resultString += "ID Pacjenta: " + str;

                // dostęp jako tablica bajtów
                gdcm.ByteValue bval = de.GetByteValue();                           // pobierz jako daną binarną
                byte[]         buff = new byte[bval.GetLength().GetValueLength()]; // przygotuj tablicę bajtów
                bval.GetBuffer(buff, (uint)buff.Length);                           // skopiuj zawartość
                // a co z tym dalej zrobić to już inna kwestia...

                //Console.WriteLine();
            }
            return(resultString);
        }