use of org.karnak.backend.model.dicom.WadoNodeList in project karnak by OsiriX-Foundation.
the class MonitorView method buildwadoNodeListSelector.
private void buildwadoNodeListSelector() {
wadoNodeListSelector = new Select<>();
wadoNodeListSelector.setEmptySelectionAllowed(false);
WadoNodeList pacsProdWadoNodeList = Util.readWadoNodes(this.getClass().getResource("/config/pacs-wado-web.csv"), "Public web");
wadoNodeListSelector.setItems(pacsProdWadoNodeList);
wadoNodeListSelector.addValueChangeListener((ValueChangeListener<ValueChangeEvent<WadoNodeList>>) event -> logic.wadoNodeListSelected(event.getValue()));
if (!pacsProdWadoNodeList.isEmpty()) {
wadoNodeListSelector.setValue(pacsProdWadoNodeList);
}
}
use of org.karnak.backend.model.dicom.WadoNodeList in project karnak by OsiriX-Foundation.
the class Util method readWadoNodes.
public static WadoNodeList readWadoNodes(URL url, String name) {
WadoNodeList list = new WadoNodeList(name);
if (url != null) {
Scanner scan = null;
try {
// $NON-NLS-1$
scan = new Scanner(url.openStream(), StandardCharsets.UTF_8);
while (scan.hasNext()) {
String val = scan.nextLine();
if (val.startsWith("#")) {
continue;
}
// $NON-NLS-1$
String[] line = val.split(",(?=([^\"]*\"[^\"]*\")*+[^\"]*$)", -1);
if (line.length >= 2) {
try {
WadoNode node = new WadoNode(trimSplit(line[0]), new URL(trimSplit(line[1])));
list.add(node);
for (int i = 2; i < line.length; i++) {
node.getTags().add(trimSplit(line[i]));
}
} catch (Exception e) {
System.out.println("Cannot read wado node: " + line[2]);
}
}
}
} catch (Exception e) {
System.out.println("Cannot read wado nodes files: " + url);
} finally {
if (scan != null) {
scan.close();
}
}
}
return list;
}
Aggregations