Search in sources :

Example 6 with IJDataList

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);
}
Also used : VCellModelSearchResults(org.vcell.imagej.helper.VCellHelper.VCellModelSearchResults) VCellHelper(org.vcell.imagej.helper.VCellHelper) DoubleType(net.imglib2.type.numeric.real.DoubleType) IJDataList(org.vcell.imagej.helper.VCellHelper.IJDataList) BasicStackDimensions(org.vcell.imagej.helper.VCellHelper.BasicStackDimensions) DoubleArray(net.imglib2.img.basictypeaccess.array.DoubleArray)

Aggregations

IJDataList (org.vcell.imagej.helper.VCellHelper.IJDataList)6 DoubleArray (net.imglib2.img.basictypeaccess.array.DoubleArray)4 DoubleType (net.imglib2.type.numeric.real.DoubleType)4 BasicStackDimensions (org.vcell.imagej.helper.VCellHelper.BasicStackDimensions)4 VCellHelper (org.vcell.imagej.helper.VCellHelper)3 VCellModelSearchResults (org.vcell.imagej.helper.VCellHelper.VCellModelSearchResults)3 JFrame (javax.swing.JFrame)2 ImgPlus (net.imagej.ImgPlus)2 DefaultLinearAxis (net.imagej.axis.DefaultLinearAxis)2 DefaultDatasetView (net.imagej.display.DefaultDatasetView)2 DefaultImageDisplay (net.imagej.display.DefaultImageDisplay)2 ChartPanel (org.jfree.chart.ChartPanel)2 JFreeChart (org.jfree.chart.JFreeChart)2 Range (org.jfree.data.Range)2 DefaultXYDataset (org.jfree.data.xy.DefaultXYDataset)2 IJTimeSeriesJobResults (org.vcell.imagej.helper.VCellHelper.IJTimeSeriesJobResults)2 IJVarInfos (org.vcell.imagej.helper.VCellHelper.IJVarInfos)2