/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package clips.dicom.model;
import clips.dicom.dicombaseclass.DICOMChekup;
import clips.dicom.dicombaseclass.DICOMException;
import clips.dicom.dicomdataimpl.DICOMDataDump;
import clips.dicom.dicomdataimpl.DicomFileInput;
import clips.main.ClipsConfig;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.TreeMap;
/**
*
* @author finder
*/
public class DumpLoader implements Runnable {
@Override
public void run() {
File dubpDir = ClipsConfig.getInstance().getDicomDumpDir();
if (!dubpDir.exists() || !dubpDir.isDirectory()) {
return;
}
TreeMap<Integer, File> tree = new TreeMap<Integer, File>();
String[] nameList = dubpDir.list();
for (String name: nameList) {
int id = ClipsDicomConfigStore.parseDumpFileName(name);
if (id >= 0){
tree.put(id, new File(dubpDir, name));
}
}
DicomFileInput input = new DicomFileInput();
for (File file: tree.values()){
try {
ArrayList<DICOMChekup> objects = input.decodeZipFile(file, false);
DICOMDataDump dump = new DICOMDataDump(file, true);
for (DICOMChekup chekup : objects) {
chekup.setOriginalData(dump);
}
Agregator.agregator.onAcceptImp(objects);
} catch (IOException ex) {
ex.printStackTrace();
} catch (DICOMException ex) {
ex.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
input = new DicomFileInput();
}
}
}
}