use of cbit.vcell.client.data.DataIdentifierFilter in project vcell by virtualcell.
the class FRAPStudyPanel method refreshPDEDisplay.
protected void refreshPDEDisplay(DisplayChoice choice) throws Exception {
Simulation sim = null;
FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
if (fStudy == null || fStudy.getBioModel() == null || fStudy.getBioModel().getSimulations() == null || fStudy.getBioModel().getSimulations().length < 1) {
return;
}
sim = fStudy.getBioModel().getSimulations()[0];
FieldFunctionArguments[] fieldFunctionArgs = FieldUtilities.getFieldFunctionArguments(sim.getMathDescription());
FieldDataIdentifierSpec[] fieldDataIdentifierSpecs = new FieldDataIdentifierSpec[fieldFunctionArgs.length];
for (int i = 0; i < fieldDataIdentifierSpecs.length; i++) {
fieldDataIdentifierSpecs[i] = new FieldDataIdentifierSpec(fieldFunctionArgs[i], fStudy.getFrapDataExternalDataInfo().getExternalDataIdentifier());
}
PDEDataViewer flourViewer = getFlourDataViewer();
PDEDataManager dataManager = null;
if (choice == DisplayChoice.EXTTIMEDATA) {
flourViewer.setSimulation(null);
flourViewer.setPdeDataContext(null);
flourViewer.setDataIdentifierFilter(new DataIdentifierFilter() {
private String ALL_DATAIDENTIFIERS = "All";
private String EXP_NORM_FLUOR = "Exp. Norm. Fluor";
private String SIM_NORM_FLUOR = "Sim. Norm. Fluor";
private String DEFAULT_VIEW = "Default View (more...)";
private String[] filterSetNames = new String[] { ALL_DATAIDENTIFIERS, EXP_NORM_FLUOR, SIM_NORM_FLUOR, DEFAULT_VIEW };
public boolean accept(String filterSetName, List<AnnotatedFunction> myFunctionList, DataIdentifier dataidentifier) {
if (filterSetName.equals(ALL_DATAIDENTIFIERS)) {
return true;
} else if (filterSetName.equals(EXP_NORM_FLUOR)) {
return dataidentifier.getName().indexOf(NORM_FLUOR_VAR) != -1;
} else if (filterSetName.equals(SIM_NORM_FLUOR)) {
boolean a = (dataidentifier.getName().indexOf(REACTION_RATE_PREFIX) == -1) && ((dataidentifier.getName().indexOf(FRAPStudy.SPECIES_NAME_PREFIX_COMBINED) != -1) || (dataidentifier.getName().indexOf(FRAPStudy.SPECIES_NAME_PREFIX_IMMOBILE) != -1) || (dataidentifier.getName().indexOf(FRAPStudy.SPECIES_NAME_PREFIX_MOBILE) != -1) || (dataidentifier.getName().indexOf(FRAPStudy.SPECIES_NAME_PREFIX_SLOW_MOBILE) != -1));
return a;
} else if (filterSetName.equals(DEFAULT_VIEW)) {
boolean a = (dataidentifier.getName().indexOf(REACTION_RATE_PREFIX) == -1) && ((dataidentifier.getName().indexOf(NORM_FLUOR_VAR) != -1) || (dataidentifier.getName().indexOf(NORM_SIM_VAR) != -1));
return a;
}
throw new IllegalArgumentException("DataIdentifierFilter: Unknown filterSetName " + filterSetName);
}
public String getDefaultFilterName() {
return DEFAULT_VIEW;
}
public String[] getFilterSetNames() {
return filterSetNames;
}
public boolean isAcceptAll(String filterSetName) {
return filterSetName.equals(ALL_DATAIDENTIFIERS);
}
@Override
public void setPostProcessingMode(boolean bPostProcessingMode) {
// TODO Auto-generated method stub
}
@Override
public boolean isPostProcessingMode() {
// TODO Auto-generated method stub
return false;
}
@Override
public ArrayList<DataIdentifier> accept(String filterSetName, List<AnnotatedFunction> myFunctionList, DataIdentifier[] dataidentifiers) {
if (filterSetName.equals(DEFAULT_VIEW)) {
ArrayList<DataIdentifier> dataIds = new ArrayList<>();
if (dataidentifiers != null) {
for (int i = 0; i < dataidentifiers.length; i++) {
dataIds.add(dataidentifiers[i]);
}
}
return dataIds;
}
throw new RuntimeException("Not Implemented for FRAP");
}
});
ExternalDataIdentifier timeSeriesExtDataID = fStudy.getFrapDataExternalDataInfo().getExternalDataIdentifier();
ExternalDataIdentifier maskExtDataID = fStudy.getRoiExternalDataInfo().getExternalDataIdentifier();
// add sim
int jobIndex = 0;
SimulationJob simJob = new SimulationJob(sim, jobIndex, fieldDataIdentifierSpecs);
// add function to display normalized fluorence data
Norm_Exp_Fluor = new Expression(Norm_Exp_Fluor_Str);
SimulationSymbolTable simSymbolTable = simJob.getSimulationSymbolTable();
if (// one diffusing component
simSymbolTable.getVariable(FRAPStudy.SPECIES_NAME_PREFIX_SLOW_MOBILE) == null) {
Norm_Sim = new Expression(Norm_Sim_One_Diff_Str);
} else // two diffusing components
{
Norm_Sim = new Expression(Norm_Sim_Two_Diff_Str);
}
AnnotatedFunction[] func = { new AnnotatedFunction(NORM_FLUOR_VAR, Norm_Exp_Fluor, null, null, VariableType.VOLUME, FunctionCategory.OLDUSERDEFINED), new AnnotatedFunction(NORM_SIM_VAR, Norm_Sim, null, null, VariableType.VOLUME, FunctionCategory.OLDUSERDEFINED) };
VCDataIdentifier[] dataIDs = new VCDataIdentifier[] { timeSeriesExtDataID, maskExtDataID, simJob.getVCDataIdentifier() };
VCDataIdentifier vcDataId = new MergedDataInfo(LocalWorkspace.getDefaultOwner(), dataIDs, FRAPStudy.VFRAP_DS_PREFIX);
outputContext = new OutputContext(func);
dataManager = new PDEDataManager(outputContext, getLocalWorkspace().getVCDataManager(), vcDataId);
ClientPDEDataContext pdeDataContext = new ClientPDEDataContext(dataManager);
pdeDataContext.refreshIdentifiers();
flourViewer.setSimulation(sim);
flourViewer.setPdeDataContext(pdeDataContext);
SimulationModelInfo simModelInfo = new SimulationWorkspaceModelInfo(fStudy.getBioModel().getSimulationContext(sim), sim.getName());
flourViewer.setSimulationModelInfo(simModelInfo);
getLocalWorkspace().getDataSetControllerImpl().addDataJobListener(flourViewer);
((VirtualFrapWindowManager) flourViewer.getDataViewerManager()).setLocalWorkSpace(getLocalWorkspace());
// do now show post data processing for VFRAP
flourViewer.setPostProcessingPanelVisible(false);
flourViewer.repaint();
}
}
Aggregations