use of org.vcell.imagej.helper.VCellHelper.IJDataList in project vcell by virtualcell.
the class ModelLoad method run.
@Override
public void run() {
displayProgressBar(true, "Checking listening ports...", "Checking for VCell Client");
startJProgressThread0(null, "Check");
try {
// Find the port that a separately running VCell client is listening on
//
System.out.println("vcell service port=" + vcellHelper.findVCellApiServerPort());
// uiService.getDisplayViewer(textDisplay).dispose();
displayProgressBar(false, null, null);
} catch (Exception e) {
// e.printStackTrace();
displayProgressBar(false, null, null);
// uiService.getDisplayViewer(textDisplay).dispose();
uiService.showDialog("Activate VCell client ImageJ service\nTools->'Start Fiji (ImageJ) service'\n" + e.getMessage(), "Couldn't contact VCell client", MessageType.ERROR_MESSAGE);
return;
}
displayProgressBar(true, "Searching...", "Searching VCell Models");
startJProgressThread0("Check", "Search");
String theCacheKey = null;
VCellHelper.VCellModelSearch vcms = new VCellHelper.VCellModelSearch(VCellHelper.ModelType.bm, vCellUser, vCellModel, application, simulation, null, null);
try {
ArrayList<VCellModelSearchResults> vcmsr = vcellHelper.getSearchedModelSimCacheKey(false, vcms, null);
if (vcmsr.size() == 0) {
throw new Exception("No Results for search found");
}
theCacheKey = vcmsr.get(0).getCacheKey();
System.out.println("theCacheKey=" + theCacheKey);
displayProgressBar(false, null, null);
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
uiService.showDialog("VCellHelper.ModelType.bm,vCellUser,vCellModel,application,simulation,null,null\n" + e.getMessage(), "Search failed", MessageType.ERROR_MESSAGE);
displayProgressBar(false, null, null);
}
displayProgressBar(true, "Loading Data...", "Loading Data");
startJProgressThread0("Search", "getTimePointData");
try {
String var = variable;
int[] time = new int[] { timePoint };
IJDataList tpd = vcellHelper.getTimePointData(theCacheKey, var, VCellHelper.VARTYPE_POSTPROC.NotPostProcess, time, 0);
double[] data = tpd.ijData[0].getDoubleData();
BasicStackDimensions bsd = tpd.ijData[0].stackInfo;
System.out.println(bsd.xsize + " " + bsd.ysize);
ArrayImg<DoubleType, DoubleArray> testimg = ArrayImgs.doubles(data, bsd.xsize, bsd.ysize);
uiService.show(testimg);
displayProgressBar(false, null, null);
} catch (Exception e) {
// TODO Auto-generated catch block
// e.printStackTrace();
uiService.showDialog("theCacheKey,var,VCellHelper.VARTYPE_POSTPROC.NotPostProcess,time,0\n" + e.getMessage(), "getTimePoint(...) failed", MessageType.ERROR_MESSAGE);
displayProgressBar(false, null, null);
}
startJProgressThread0("getTimePointData", null);
}
Aggregations