use of cbit.vcell.math.ConvolutionDataGenerator.ConvolutionDataGeneratorKernel in project vcell by virtualcell.
the class XmlReader method getConvolutionDataGenerator.
private ConvolutionDataGenerator getConvolutionDataGenerator(Element element) {
String name = unMangle(element.getAttributeValue(XMLTags.NameAttrTag));
Expression volumeFunction = null;
Element volumeFunctionElement = element.getChild(XMLTags.FunctionTag, vcNamespace);
if (volumeFunctionElement == null) {
volumeFunctionElement = element.getChild(XMLTags.VolumeFunctionTag, vcNamespace);
}
if (volumeFunctionElement != null) {
String s = volumeFunctionElement.getText();
volumeFunction = unMangleExpression(s);
}
Expression membraneFunction = null;
Element membraneFunctionElement = element.getChild(XMLTags.MembraneFunctionTag, vcNamespace);
if (membraneFunctionElement != null) {
String s = membraneFunctionElement.getText();
membraneFunction = unMangleExpression(s);
}
ConvolutionDataGeneratorKernel kernel = null;
Element kernelElement = element.getChild(XMLTags.Kernel, vcNamespace);
String kernelType = kernelElement.getAttributeValue(XMLTags.TypeAttrTag);
if (kernelType.equals(XMLTags.KernelType_Gaussian)) {
Element e0 = kernelElement.getChild(XMLTags.KernelGaussianSigmaXY, vcNamespace);
String s = e0.getText();
Expression sigmaXY = unMangleExpression(s);
e0 = kernelElement.getChild(XMLTags.KernelGaussianSigmaZ, vcNamespace);
s = e0.getText();
Expression sigmaZ = unMangleExpression(s);
kernel = new GaussianConvolutionDataGeneratorKernel(sigmaXY, sigmaZ);
}
ConvolutionDataGenerator cdg = new ConvolutionDataGenerator(name, kernel, volumeFunction, membraneFunction);
return cdg;
}
use of cbit.vcell.math.ConvolutionDataGenerator.ConvolutionDataGeneratorKernel in project vcell by virtualcell.
the class Xmlproducer method getXML.
private Element getXML(ConvolutionDataGenerator convolutionDataGenerator) {
Element element = new Element(XMLTags.ConvolutionDataGenerator);
element.setAttribute(XMLTags.NameAttrTag, mangle(convolutionDataGenerator.getName()));
Element kernelElement = new Element(XMLTags.Kernel);
ConvolutionDataGeneratorKernel kernel = convolutionDataGenerator.getKernel();
if (kernel instanceof GaussianConvolutionDataGeneratorKernel) {
kernelElement.setAttribute(XMLTags.TypeAttrTag, XMLTags.KernelType_Gaussian);
GaussianConvolutionDataGeneratorKernel gck = (GaussianConvolutionDataGeneratorKernel) kernel;
Element e = new Element(XMLTags.KernelGaussianSigmaXY);
e.addContent(mangleExpression(gck.getSigmaXY_um()));
kernelElement.addContent(e);
e = new Element(XMLTags.KernelGaussianSigmaZ);
e.addContent(mangleExpression(gck.getSigmaZ_um()));
kernelElement.addContent(e);
}
element.addContent(kernelElement);
if (convolutionDataGenerator.getVolFunction() != null) {
Element e = new Element(XMLTags.VolumeFunctionTag);
e.addContent(mangleExpression(convolutionDataGenerator.getVolFunction()));
element.addContent(e);
}
if (convolutionDataGenerator.getMemFunction() != null) {
Element e = new Element(XMLTags.MembraneFunctionTag);
e.addContent(mangleExpression(convolutionDataGenerator.getMemFunction()));
element.addContent(e);
}
return element;
}
use of cbit.vcell.math.ConvolutionDataGenerator.ConvolutionDataGeneratorKernel in project vcell by virtualcell.
the class FiniteVolumeFileWriter method writePostProcessingBlock.
private void writePostProcessingBlock() throws Exception {
// SolverException, ExpressionException and exceptions from roiDataGenerator.getROIDataGeneratorDescription()
PostProcessingBlock postProcessingBlock = simTask.getSimulation().getMathDescription().getPostProcessingBlock();
if (postProcessingBlock.getNumDataGenerators() == 0) {
// to make c++ code write default var statisitcs, without the token it won't write anything
printWriter.println(FVInputFileKeyword.POST_PROCESSING_BLOCK_BEGIN);
printWriter.println(FVInputFileKeyword.POST_PROCESSING_BLOCK_END);
printWriter.println();
return;
}
if (bChomboSolver && postProcessingBlock.getDataGeneratorList().size() > 0) {
throw new Exception("Data generators are not supported by " + simTask.getSimulation().getSolverTaskDescription().getSolverDescription().getDisplayLabel());
}
printWriter.println(" # Post Processing Block");
printWriter.println(FVInputFileKeyword.POST_PROCESSING_BLOCK_BEGIN);
for (DataGenerator dataGenerator : postProcessingBlock.getDataGeneratorList()) {
String varName = dataGenerator.getName();
Domain domain = dataGenerator.getDomain();
String domainName = domain == null ? null : domain.getName();
if (dataGenerator instanceof ProjectionDataGenerator) {
ProjectionDataGenerator pdg = (ProjectionDataGenerator) dataGenerator;
Expression function = subsituteExpression(pdg.getFunction(), VariableDomain.VARIABLEDOMAIN_VOLUME);
printWriter.println(FVInputFileKeyword.PROJECTION_DATA_GENERATOR + " " + varName + " " + domainName + " " + pdg.getAxis() + " " + pdg.getOperation() + " " + function.infix() + ";");
} else if (dataGenerator instanceof ConvolutionDataGenerator) {
ConvolutionDataGenerator convolutionDataGenerator = (ConvolutionDataGenerator) dataGenerator;
ConvolutionDataGeneratorKernel kernel = convolutionDataGenerator.getKernel();
if (kernel instanceof GaussianConvolutionDataGeneratorKernel) {
GaussianConvolutionDataGeneratorKernel gck = (GaussianConvolutionDataGeneratorKernel) kernel;
Expression volFunction = subsituteExpression(convolutionDataGenerator.getVolFunction(), VariableDomain.VARIABLEDOMAIN_VOLUME);
Expression memFunction = subsituteExpression(convolutionDataGenerator.getMemFunction(), VariableDomain.VARIABLEDOMAIN_MEMBRANE);
Expression sigmaXY = subsituteExpression(gck.getSigmaXY_um(), VariableDomain.VARIABLEDOMAIN_VOLUME);
Expression sigmaZ = subsituteExpression(gck.getSigmaZ_um(), VariableDomain.VARIABLEDOMAIN_VOLUME);
String volFuncStr = volFunction.infix();
String memFuncStr = memFunction.infix();
printWriter.println(FVInputFileKeyword.GAUSSIAN_CONVOLUTION_DATA_GENERATOR + " " + varName + " " + domainName + " " + sigmaXY.infix() + " " + sigmaZ.infix() + " " + FVInputFileKeyword.GAUSSIAN_CONVOLUTION_VOL_FUNCTION + " " + volFuncStr + "; " + FVInputFileKeyword.GAUSSIAN_CONVOLUTION_MEM_FUNCTION + " " + memFuncStr + ";");
}
} else if (dataGenerator instanceof cbit.vcell.microscopy.ROIDataGenerator) {
/*
ROI_DATA_GENERATOR_BEGIN roidata
VolumePoints 20
2667 2676 2679 2771 2969 2877 3067 3277 3185 3283 3473 3580 3690 3687 3878 4086 3990 4182 4193 1077 (all points in one line)
SampleImage 9 0 1341426862190 vcField('sumROIData','roiSumDataVar',0.0,'Volume')
StoreEnabled false
SampleImageFile roiSumDataVar 0.0 C:\Users\abcde\VirtualMicroscopy\SimulationData\SimID_1341426862125_0_sumROIData_roiSumDataVar_0_0_Volume.fdat
DATA_PROCESSOR_END
*/
cbit.vcell.microscopy.ROIDataGenerator roiDataGenerator = (cbit.vcell.microscopy.ROIDataGenerator) dataGenerator;
printWriter.println(roiDataGenerator.getROIDataGeneratorDescription(workingDirectory, simTask.getSimulationJob()));
} else if (dataGenerator instanceof org.vcell.vmicro.workflow.data.ROIDataGenerator) {
/*
ROI_DATA_GENERATOR_BEGIN roidata
VolumePoints 20
2667 2676 2679 2771 2969 2877 3067 3277 3185 3283 3473 3580 3690 3687 3878 4086 3990 4182 4193 1077 (all points in one line)
SampleImage 9 0 1341426862190 vcField('sumROIData','roiSumDataVar',0.0,'Volume')
StoreEnabled false
SampleImageFile roiSumDataVar 0.0 C:\Users\abcde\VirtualMicroscopy\SimulationData\SimID_1341426862125_0_sumROIData_roiSumDataVar_0_0_Volume.fdat
DATA_PROCESSOR_END
*/
org.vcell.vmicro.workflow.data.ROIDataGenerator roiDataGenerator = (org.vcell.vmicro.workflow.data.ROIDataGenerator) dataGenerator;
printWriter.println(roiDataGenerator.getROIDataGeneratorDescription(workingDirectory, simTask.getSimulationJob()));
} else {
throw new SolverException(dataGenerator.getClass() + " : data generator not supported yet.");
}
}
printWriter.println(FVInputFileKeyword.POST_PROCESSING_BLOCK_END);
printWriter.println();
}
Aggregations