Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
salimkanoun authored Apr 3, 2018
1 parent cdba7bc commit 4b3609a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 38 deletions.
17 changes: 7 additions & 10 deletions src/org/petctviewer/orthanc/monitoring/CD_Burner.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,14 @@ public File printDat(String nom, String id, String date, String studyDescription
//SK Remplace le WatchFolder
//A Faire
public void watchOrthancStableStudies() {
Orthanc_Monitoring monitoring=new Orthanc_Monitoring(true);
Orthanc_Monitoring monitoring=new Orthanc_Monitoring();
//Met la derniere ligne pour commencer le monitoring
int last=monitoring.getChangeLastLine();
monitoring.setChangeLastLine(last);
//SK
monitoring.makeMonitor();
for (int i=0; i<monitoring.newStudyID.size(); i++) {
boolean stable=monitoring.studyIsStable(monitoring.newStudyID.get(i));
if (stable) {

}
//Necessite d'attendre qu'elle soit stable
else {

}
for (int i=0; i<monitoring.newStableStudyID.size(); i++) {
// SK TELECHARGER LES ZIP ET FAIRE LE PROCESSING

}

Expand Down
55 changes: 27 additions & 28 deletions src/org/petctviewer/orthanc/monitoring/Orthanc_Monitoring.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,24 @@ public class Orthanc_Monitoring {
private boolean done;

//CD Burner variable
private boolean cdBurnerService;
protected List<String> newStableStudyID = new ArrayList<String>();
protected List<String> newStablePatientID = new ArrayList<String>();
protected List<String> newPatientID = new ArrayList<String>();
protected List<String> newStudyID = new ArrayList<String>();
protected List<String> newSerieID = new ArrayList<String>();

//Connxion API
ParametreConnexionHttp connexion=new ParametreConnexionHttp();

public static void main(String[] args) throws IOException, ParseException {
Orthanc_Monitoring monitor=new Orthanc_Monitoring(false);
Orthanc_Monitoring monitor=new Orthanc_Monitoring();
monitor.makeMonitor();


}

public Orthanc_Monitoring(boolean cdBurnerService) {
this.cdBurnerService=cdBurnerService;
public Orthanc_Monitoring() {

}

public void makeMonitor() {
Expand Down Expand Up @@ -83,18 +86,31 @@ private void parseOutput(String outputStream) throws ParseException {
JSONArray changesArray=(JSONArray) changes.get("Changes");
for (int i=0; i<changesArray.size(); i++) {
JSONObject changeEvent=(JSONObject) changesArray.get(i);
String ID= (String) changeEvent.get("ID");

if (changeEvent.get("ChangeType").equals("NewStudy")) {
if (cdBurnerService) {
newStudyID.add((String) changeEvent.get("ID"));

}
else parseStudy((String) changeEvent.get("ID"));
if (changeEvent.get("ChangeType").equals("NewPatient")) {
newPatientID.add(ID);
}

else if (changeEvent.get("ChangeType").equals("NewStudy")) {
newStudyID.add(ID);
System.out.println(ID);
//parseStudy(ID);
}

else if (changeEvent.get("ChangeType").equals("NewSeries")) {
parseSerie((String) changeEvent.get("ID"));
newSerieID.add(ID);
//parseSerie(ID);
}

else if (changeEvent.get("ChangeType").equals("StablePatient")) {
newStablePatientID.add((String) changeEvent.get("ID"));
}

else if (changeEvent.get("ChangeType").equals("StableStudy")) {
newStableStudyID.add((String) changeEvent.get("ID"));
}

}

last=Integer.parseInt(changes.get("Last").toString());
Expand Down Expand Up @@ -122,24 +138,7 @@ private void parseStudy(String id) {

} catch (ParseException | IOException e) {e.printStackTrace();}
}
/**
* test if study is stable
* @param id
*/

public boolean studyIsStable(String id) {
StringBuilder sb = null;
boolean isStable = false;
try {
sb = connexion.makeGetConnectionAndStringBuilder("/studies/"+id+"/");
JSONObject getStudiesInfo = (JSONObject) parser.parse(sb.toString());
isStable= (boolean) getStudiesInfo.get("IsStable");

} catch (ParseException | IOException e) {e.printStackTrace();}

return isStable;

}
/**
* Parse info Series pour determiner modalite
* @param id
Expand Down

0 comments on commit 4b3609a

Please sign in to comment.