Hallo zusammen,
ich brauche eure Unterstützung.
In meinem Programm wird ein Server mit Test Patientendaten abgefragt.
Dieser Server Antwortet und gibt zu jedem Patienteneintrag mehrere Informationen zurück.
Jede dieser Info: ( studyInstanceUID:1.2.826.0.1.3680043.6.30452.15777.20210115165916.792.13test image001test20210115 ) soll in eine Liste angezeigt werden.
Leider bekomme ich es nicht hin die Informationen in eine ObservableList einzufügen.
Wie kann ich es in meinem Programm am besten machen:
Hier mein Programm:
[CODE lang="java" title="DICOM QR" highlight="137-158"]import java.util.Properties;
import com.pixelmed.dicom.Attribute;
import com.pixelmed.dicom.AttributeList;
import com.pixelmed.dicom.DicomException;
import com.pixelmed.dicom.SOPClass;
import com.pixelmed.dicom.SpecificCharacterSet;
import com.pixelmed.dicom.TagFromName;
import com.pixelmed.network.FindSOPClassSCU;
import com.pixelmed.network.IdentifierHandler;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableArray;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Stage;
public class DicomCfindApp extends Application{
@Override
public void start(Stage primaryStage) throws Exception {
Group root = new Group();
Scene scene = new Scene(root,500,520);
Label label = new Label("QR");
label.setFont(new Font(20));
TextField patname = new TextField();
Button button = new Button("Suchen");
TableView<IOD> tableView = new TableView<IOD>();
TableColumn<IOD, String> patnameCol = new TableColumn<IOD, String>("Name");
TableColumn<IOD, String> patidCol = new TableColumn<IOD, String>("PAT_ID");
TableColumn<IOD, String> dobCol = new TableColumn<IOD, String>("DOB");
TableColumn<IOD, String> sexCol = new TableColumn<IOD, String>("Sex");
TableColumn<IOD, String> studyDescCol = new TableColumn<IOD, String>("StudyDesc");
TableColumn<IOD, String> studyiuidCol = new TableColumn<IOD, String>("StudyIUID");
tableView.getColumns().addAll(patnameCol,patidCol,dobCol,sexCol,studyDescCol,studyiuidCol);
patnameCol.setCellValueFactory(new PropertyValueFactory("PatientName"));
patidCol.setCellValueFactory(new PropertyValueFactory("PatientID"));
dobCol.setCellValueFactory(new PropertyValueFactory("dOb"));
sexCol.setCellValueFactory(new PropertyValueFactory("seX"));
studyDescCol.setCellValueFactory(new PropertyValueFactory("dEsc"));
studyiuidCol.setCellValueFactory(new PropertyValueFactory("sIUID"));
ObservableList<IOD> list = getPatIOD();
tableView.setItems(list);
VBox vBox = new VBox(10);
vBox.setPadding(new Insets(0, 0, 0, 10));
vBox.getChildren().addAll(label,patname,button,tableView);
root.getChildren().addAll(vBox);
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
if ( !patname.getText().isEmpty()) {
String pname = patname.getText();
cfind(pname);
}
else {
System.out.println("Kein Namen angegeben");
}
}
});
primaryStage.setScene(scene);
primaryStage.show();
}
private ObservableList<IOD> getPatIOD() {
IOD pat1 = new IOD("TEST^Allergator","6702200","19450706","M","MR-Schädel","1.2.826.0.1.3680043.6.30452.15777.20210115165916.792.13");
ObservableList<IOD> list = FXCollections.observableArrayList(pat1);
return list;
}
protected void cfind(String pname) {
try {
// use the default character set for VR encoding - override this as necessary
SpecificCharacterSet specificCharacterSet = new SpecificCharacterSet((String[])null);
AttributeList identifier = new AttributeList();
//build the attributes that you would like to retrieve as well as passing in any search criteria
identifier.putNewAttribute(TagFromName.QueryRetrieveLevel).addValue("STUDY"); //specific query root
identifier.putNewAttribute(TagFromName.PatientName,specificCharacterSet).addValue(pname);
System.out.println(pname);
identifier.putNewAttribute(TagFromName.PatientID,specificCharacterSet);
identifier.putNewAttribute(TagFromName.PatientBirthDate);
identifier.putNewAttribute(TagFromName.PatientSex);
identifier.putNewAttribute(TagFromName.StudyInstanceUID);
identifier.putNewAttribute(TagFromName.SeriesInstanceUID);
identifier.putNewAttribute(TagFromName.SOPInstanceUID);
identifier.putNewAttribute(TagFromName.StudyDescription);
identifier.putNewAttribute(TagFromName.StudyDate);
//retrieve all studies belonging to patient with name 'Bowen'
new FindSOPClassSCU("www.dicomserver.co.uk",
104,
"MEDCONNEC",
"OURCLIENT",
SOPClass.StudyRootQueryRetrieveInformationModelFind,identifier,
//new IdentifierHandler());
new OurCustomFindIdentifierHandler());
}
catch (Exception e) {
e.printStackTrace(System.err); // in real life, do something about this exception
System.exit(0);
}
}
class OurCustomFindIdentifierHandler extends IdentifierHandler {
//add additional constructors here as necessary to pass more information handling
@Override
public void doSomethingWithIdentifier(AttributeList attributeListForFindResult) throws DicomException {
//System.out.println("Matched result:" + attributeListForFindResult);
String studyInstanceUID = attributeListForFindResult.get(TagFromName.StudyInstanceUID).getSingleStringValueOrEmptyString();
String studyDesc = attributeListForFindResult.get(TagFromName.StudyDescription).getSingleStringValueOrEmptyString();
String patid = attributeListForFindResult.get(TagFromName.PatientID).getSingleStringValueOrEmptyString();
String patname = attributeListForFindResult.get(TagFromName.PatientName).getSingleStringValueOrEmptyString();
String dob = attributeListForFindResult.get(TagFromName.PatientBirthDate).getSingleStringValueOrEmptyString();
String studyDate = attributeListForFindResult.get(TagFromName.StudyDate).getSingleStringValueOrEmptyString();
System.out.println("studyInstanceUID:" + studyInstanceUID + studyDesc + patid + patname + dob + studyDate);
//do other things you need to do with the matched results
}
}
public static void main(String[] args) {
launch(args);
}
}
[/CODE]
Im OurCustomFindIdentifierHandler werden die Info vom Server zurückgeholt.
Für jede Hilfe wäre ich sehr dankbar.
Viele Grüße
ich brauche eure Unterstützung.
In meinem Programm wird ein Server mit Test Patientendaten abgefragt.
Dieser Server Antwortet und gibt zu jedem Patienteneintrag mehrere Informationen zurück.
Jede dieser Info: ( studyInstanceUID:1.2.826.0.1.3680043.6.30452.15777.20210115165916.792.13test image001test20210115 ) soll in eine Liste angezeigt werden.
Leider bekomme ich es nicht hin die Informationen in eine ObservableList einzufügen.
Wie kann ich es in meinem Programm am besten machen:
Hier mein Programm:
[CODE lang="java" title="DICOM QR" highlight="137-158"]import java.util.Properties;
import com.pixelmed.dicom.Attribute;
import com.pixelmed.dicom.AttributeList;
import com.pixelmed.dicom.DicomException;
import com.pixelmed.dicom.SOPClass;
import com.pixelmed.dicom.SpecificCharacterSet;
import com.pixelmed.dicom.TagFromName;
import com.pixelmed.network.FindSOPClassSCU;
import com.pixelmed.network.IdentifierHandler;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableArray;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Stage;
public class DicomCfindApp extends Application{
@Override
public void start(Stage primaryStage) throws Exception {
Group root = new Group();
Scene scene = new Scene(root,500,520);
Label label = new Label("QR");
label.setFont(new Font(20));
TextField patname = new TextField();
Button button = new Button("Suchen");
TableView<IOD> tableView = new TableView<IOD>();
TableColumn<IOD, String> patnameCol = new TableColumn<IOD, String>("Name");
TableColumn<IOD, String> patidCol = new TableColumn<IOD, String>("PAT_ID");
TableColumn<IOD, String> dobCol = new TableColumn<IOD, String>("DOB");
TableColumn<IOD, String> sexCol = new TableColumn<IOD, String>("Sex");
TableColumn<IOD, String> studyDescCol = new TableColumn<IOD, String>("StudyDesc");
TableColumn<IOD, String> studyiuidCol = new TableColumn<IOD, String>("StudyIUID");
tableView.getColumns().addAll(patnameCol,patidCol,dobCol,sexCol,studyDescCol,studyiuidCol);
patnameCol.setCellValueFactory(new PropertyValueFactory("PatientName"));
patidCol.setCellValueFactory(new PropertyValueFactory("PatientID"));
dobCol.setCellValueFactory(new PropertyValueFactory("dOb"));
sexCol.setCellValueFactory(new PropertyValueFactory("seX"));
studyDescCol.setCellValueFactory(new PropertyValueFactory("dEsc"));
studyiuidCol.setCellValueFactory(new PropertyValueFactory("sIUID"));
ObservableList<IOD> list = getPatIOD();
tableView.setItems(list);
VBox vBox = new VBox(10);
vBox.setPadding(new Insets(0, 0, 0, 10));
vBox.getChildren().addAll(label,patname,button,tableView);
root.getChildren().addAll(vBox);
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
if ( !patname.getText().isEmpty()) {
String pname = patname.getText();
cfind(pname);
}
else {
System.out.println("Kein Namen angegeben");
}
}
});
primaryStage.setScene(scene);
primaryStage.show();
}
private ObservableList<IOD> getPatIOD() {
IOD pat1 = new IOD("TEST^Allergator","6702200","19450706","M","MR-Schädel","1.2.826.0.1.3680043.6.30452.15777.20210115165916.792.13");
ObservableList<IOD> list = FXCollections.observableArrayList(pat1);
return list;
}
protected void cfind(String pname) {
try {
// use the default character set for VR encoding - override this as necessary
SpecificCharacterSet specificCharacterSet = new SpecificCharacterSet((String[])null);
AttributeList identifier = new AttributeList();
//build the attributes that you would like to retrieve as well as passing in any search criteria
identifier.putNewAttribute(TagFromName.QueryRetrieveLevel).addValue("STUDY"); //specific query root
identifier.putNewAttribute(TagFromName.PatientName,specificCharacterSet).addValue(pname);
System.out.println(pname);
identifier.putNewAttribute(TagFromName.PatientID,specificCharacterSet);
identifier.putNewAttribute(TagFromName.PatientBirthDate);
identifier.putNewAttribute(TagFromName.PatientSex);
identifier.putNewAttribute(TagFromName.StudyInstanceUID);
identifier.putNewAttribute(TagFromName.SeriesInstanceUID);
identifier.putNewAttribute(TagFromName.SOPInstanceUID);
identifier.putNewAttribute(TagFromName.StudyDescription);
identifier.putNewAttribute(TagFromName.StudyDate);
//retrieve all studies belonging to patient with name 'Bowen'
new FindSOPClassSCU("www.dicomserver.co.uk",
104,
"MEDCONNEC",
"OURCLIENT",
SOPClass.StudyRootQueryRetrieveInformationModelFind,identifier,
//new IdentifierHandler());
new OurCustomFindIdentifierHandler());
}
catch (Exception e) {
e.printStackTrace(System.err); // in real life, do something about this exception
System.exit(0);
}
}
class OurCustomFindIdentifierHandler extends IdentifierHandler {
//add additional constructors here as necessary to pass more information handling
@Override
public void doSomethingWithIdentifier(AttributeList attributeListForFindResult) throws DicomException {
//System.out.println("Matched result:" + attributeListForFindResult);
String studyInstanceUID = attributeListForFindResult.get(TagFromName.StudyInstanceUID).getSingleStringValueOrEmptyString();
String studyDesc = attributeListForFindResult.get(TagFromName.StudyDescription).getSingleStringValueOrEmptyString();
String patid = attributeListForFindResult.get(TagFromName.PatientID).getSingleStringValueOrEmptyString();
String patname = attributeListForFindResult.get(TagFromName.PatientName).getSingleStringValueOrEmptyString();
String dob = attributeListForFindResult.get(TagFromName.PatientBirthDate).getSingleStringValueOrEmptyString();
String studyDate = attributeListForFindResult.get(TagFromName.StudyDate).getSingleStringValueOrEmptyString();
System.out.println("studyInstanceUID:" + studyInstanceUID + studyDesc + patid + patname + dob + studyDate);
//do other things you need to do with the matched results
}
}
public static void main(String[] args) {
launch(args);
}
}
[/CODE]
Im OurCustomFindIdentifierHandler werden die Info vom Server zurückgeholt.
Für jede Hilfe wäre ich sehr dankbar.
Viele Grüße