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.");
}
}
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);
}
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);
}
}
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);
}
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;
}
Aggregations