Search in sources :

Example 26 with Range

use of org.vcell.util.Range in project vcell by virtualcell.

the class EstParams_TwoDiffComponentPanel method setData.

public void setData(final FRAPOptData frapOptData, final FRAPData fData, Parameter[] modelParams, final double[] frapDataTimeStamps, int startIndexForRecovery, boolean[] selectedROIs) throws Exception {
    this.frapOptData = frapOptData;
    double[] prebleachAverage = FrapDataUtils.calculatePreBleachAverageXYZ(fData, startIndexForRecovery);
    spatialAnalysisResults = FRAPStudy.spatialAnalysis(null, startIndexForRecovery, frapDataTimeStamps[startIndexForRecovery], modelParams, fData, prebleachAverage);
    // allDataHash use AnalysisParameters as key, the value is dataSource[] which should have length as 2: expDataSource & simDataSouce
    allDataHash = spatialAnalysisResults.createSummaryReportSourceData(frapDataTimeStamps, startIndexForRecovery, selectedROIs, false);
    final SpatialAnalysisResults finalSpatialAnalysisResults = spatialAnalysisResults;
    try {
        getPureDiffusionPanel().setData(frapOptData, modelParams);
        multisourcePlotPane.forceXYRange(new Range(frapDataTimeStamps[0], frapDataTimeStamps[frapDataTimeStamps.length - 1]), new Range(0, 1.5));
        plotDerivedSimulationResults(finalSpatialAnalysisResults.getAnalysisParameters());
    } catch (Exception e) {
        throw new RuntimeException("Error setting data to result panel for diffusion with one diffusing component.");
    }
}
Also used : SpatialAnalysisResults(cbit.vcell.microscopy.SpatialAnalysisResults) Range(org.vcell.util.Range)

Example 27 with Range

use of org.vcell.util.Range in project vcell by virtualcell.

the class VFrap_OverlayEditorPanelJAI method calcMinMaxPixelValueRange.

private Range calcMinMaxPixelValueRange(ImageDataset argImageDataset) {
    UShortImage[] allImages = argImageDataset.getAllImages();
    double min = 0;
    double max = min;
    for (int i = 0; i < allImages.length; i++) {
        ImageStatistics imageStats = allImages[i].getImageStatistics();
        if (i == 0 || imageStats.minValue < min) {
            min = imageStats.minValue;
        }
        if (i == 0 || imageStats.maxValue > max) {
            max = imageStats.maxValue;
        }
    }
    if (max < SHORT_TO_BYTE_FACTOR) {
        return new Range(min, max);
    }
    return new Range(min / SHORT_TO_BYTE_FACTOR, max / SHORT_TO_BYTE_FACTOR);
}
Also used : ImageStatistics(cbit.vcell.VirtualMicroscopy.Image.ImageStatistics) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) Range(org.vcell.util.Range) Point(java.awt.Point)

Example 28 with Range

use of org.vcell.util.Range in project vcell by virtualcell.

the class OutputOptionsPanel method actionOutputOptionButtonState.

private void actionOutputOptionButtonState(java.awt.event.ActionEvent actionEvent) {
    try {
        if (solverTaskDescription == null) {
            return;
        }
        OutputTimeSpec outputTimeSpec = solverTaskDescription.getOutputTimeSpec();
        if (actionEvent.getSource() == getDefaultOutputRadioButton() && !outputTimeSpec.isDefault()) {
            solverTaskDescription.setOutputTimeSpec(new DefaultOutputTimeSpec());
        } else if (actionEvent.getSource() == getUniformOutputRadioButton() && !outputTimeSpec.isUniform()) {
            double outputTime = 0.0;
            if (solverTaskDescription.getSolverDescription().isSemiImplicitPdeSolver()) {
                String floatStr = "" + (float) (((DefaultOutputTimeSpec) outputTimeSpec).getKeepEvery() * solverTaskDescription.getTimeStep().getDefaultTimeStep());
                outputTime = Double.parseDouble(floatStr);
            } else {
                TimeBounds timeBounds = solverTaskDescription.getTimeBounds();
                Range outputTimeRange = NumberUtils.getDecimalRange(timeBounds.getStartingTime(), timeBounds.getEndingTime() / 100, true, true);
                outputTime = outputTimeRange.getMax();
            }
            solverTaskDescription.setOutputTimeSpec(new UniformOutputTimeSpec(outputTime));
        } else if (actionEvent.getSource() == getExplicitOutputRadioButton() && !outputTimeSpec.isExplicit()) {
            TimeBounds timeBounds = solverTaskDescription.getTimeBounds();
            solverTaskDescription.setOutputTimeSpec(new ExplicitOutputTimeSpec(new double[] { timeBounds.getStartingTime(), timeBounds.getEndingTime() }));
        }
    } catch (java.lang.Throwable ivjExc) {
        handleException(ivjExc);
    }
}
Also used : TimeBounds(cbit.vcell.solver.TimeBounds) DefaultOutputTimeSpec(cbit.vcell.solver.DefaultOutputTimeSpec) UniformOutputTimeSpec(cbit.vcell.solver.UniformOutputTimeSpec) ExplicitOutputTimeSpec(cbit.vcell.solver.ExplicitOutputTimeSpec) OutputTimeSpec(cbit.vcell.solver.OutputTimeSpec) ExplicitOutputTimeSpec(cbit.vcell.solver.ExplicitOutputTimeSpec) UniformOutputTimeSpec(cbit.vcell.solver.UniformOutputTimeSpec) Range(org.vcell.util.Range) DefaultOutputTimeSpec(cbit.vcell.solver.DefaultOutputTimeSpec)

Example 29 with Range

use of org.vcell.util.Range in project vcell by virtualcell.

the class IMGExporter method main.

public static void main(String[] args) throws Exception {
    if (args.length < 7) {
        System.out.println("Usage: IMGExporter username userkey simulationkey userdatadir beginTimeIndex endTimeIndex {varName1 varName2 ...}");
        System.exit(0);
    }
    String userName = args[0];
    String userKey = args[1];
    String SimulationKey = args[2];
    String primaryDirStr = args[3];
    int beginTimeIndex = Integer.valueOf(args[4]);
    int endTimeIndex = Integer.valueOf(args[5]);
    String[] varNames = new String[args.length - 6];
    if (args.length > 6) {
        for (int i = 6; i < args.length; i++) {
            varNames[i - 6] = args[i];
        }
    }
    PropertyLoader.loadProperties();
    User user = new User(userName, new KeyValue(userKey));
    VCSimulationIdentifier vcSimID = new VCSimulationIdentifier(new KeyValue(SimulationKey), user);
    VCSimulationDataIdentifier vcdID = new VCSimulationDataIdentifier(vcSimID, 0);
    class PrintingExportServiceImpl extends ExportServiceImpl {

        public PrintingExportServiceImpl() {
            super();
        }

        @Override
        protected void fireExportEvent(ExportEvent event) {
            super.fireExportEvent(event);
            System.out.println("Event type=" + event.getEventTypeID() + " JobID=" + event.getJobID() + " progress=" + event.getProgress());
        }
    }
    ExportServiceImpl exportServiceImpl = new PrintingExportServiceImpl();
    Cachetable cachetable = new Cachetable(10 * Cachetable.minute);
    File primaryDir = new File(primaryDirStr);
    DataSetControllerImpl dataSetControllerImpl = new DataSetControllerImpl(cachetable, primaryDir, null);
    DataServerImpl dataServerImpl = new DataServerImpl(dataSetControllerImpl, exportServiceImpl);
    double[] allTimes = dataSetControllerImpl.getDataSetTimes(vcdID);
    TimeSpecs timeSpecs = new TimeSpecs(beginTimeIndex, endTimeIndex, allTimes, ExportConstants.TIME_RANGE);
    VariableSpecs variableSpecs = new VariableSpecs(varNames, ExportConstants.VARIABLE_MULTI);
    GeometrySpecs geometrySpecs = new GeometrySpecs(null, 0, 0, ExportConstants.GEOMETRY_SLICE);
    DisplayPreferences displayPreferences = new DisplayPreferences(DisplayAdapterService.BLUERED, new Range(0, 1), DisplayAdapterService.createBlueRedSpecialColors());
    MovieSpecs movieSpecs = new MovieSpecs(// /
    1000.0, // /
    false, // /
    new DisplayPreferences[] { displayPreferences }, // /
    ExportFormat.FORMAT_JPEG, // /
    0, // /
    1, // /
    1, // /
    1, ImagePaneModel.MESH_MODE, FormatSpecificSpecs.CODEC_JPEG, 1.0f, false, FormatSpecificSpecs.PARTICLE_SELECT);
    ExportSpecs exportSpecs = new ExportSpecs(vcdID, ExportFormat.QUICKTIME, variableSpecs, timeSpecs, geometrySpecs, movieSpecs, "IMGExporterTest", null);
    exportServiceImpl.makeRemoteFile(null, user, dataServerImpl, exportSpecs);
}
Also used : Cachetable(cbit.vcell.simdata.Cachetable) DataServerImpl(cbit.vcell.simdata.DataServerImpl) VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) User(org.vcell.util.document.User) KeyValue(org.vcell.util.document.KeyValue) ExportEvent(cbit.rmi.event.ExportEvent) Range(org.vcell.util.Range) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) DisplayPreferences(cbit.image.DisplayPreferences) DataSetControllerImpl(cbit.vcell.simdata.DataSetControllerImpl) File(java.io.File)

Example 30 with Range

use of org.vcell.util.Range in project vcell by virtualcell.

the class Plot2D method getXDataRange.

/**
 * Insert the method's description here.
 * Creation date: (2/8/2001 1:32:46 PM)
 * @return cbit.image.Range
 */
public Range getXDataRange() {
    double xmin = 0;
    double xmax = 0;
    for (int i = 0; i < plotDatas.length; i++) {
        if (isVisiblePlot(i)) {
            xmin = Math.min(xmin, plotDatas[i].getIndependentMin());
            xmax = Math.max(xmax, plotDatas[i].getIndependentMax());
        }
    }
    xDataRange = new Range(xmin, xmax);
    return xDataRange;
}
Also used : Range(org.vcell.util.Range)

Aggregations

Range (org.vcell.util.Range)54 Point (java.awt.Point)12 SourceDataInfo (cbit.image.SourceDataInfo)5 Paint (java.awt.Paint)4 DecimalFormat (java.text.DecimalFormat)4 DisplayAdapterService (cbit.image.DisplayAdapterService)3 SinglePoint (cbit.vcell.geometry.SinglePoint)3 SpatialAnalysisResults (cbit.vcell.microscopy.SpatialAnalysisResults)3 DisplayPreferences (cbit.image.DisplayPreferences)2 Plot2D (cbit.plot.Plot2D)2 PlotData (cbit.plot.PlotData)2 ExportEvent (cbit.rmi.event.ExportEvent)2 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)2 VariableType (cbit.vcell.math.VariableType)2 VolVariable (cbit.vcell.math.VolVariable)2 MergedDataInfo (cbit.vcell.simdata.MergedDataInfo)2 VCSimulationDataIdentifier (cbit.vcell.solver.VCSimulationDataIdentifier)2 CartesianMesh (cbit.vcell.solvers.CartesianMesh)2 ExternalDataIdentifier (org.vcell.util.document.ExternalDataIdentifier)2 VCDataIdentifier (org.vcell.util.document.VCDataIdentifier)2