use of org.vcell.util.ISize in project vcell by virtualcell.
the class FRAPStudy method getROIDataGenerator.
public ROIDataGenerator getROIDataGenerator(LocalWorkspace localWorkspace) {
// create ROI image
short[] roiFieldData = null;
ROI[] rois = getFrapData().getRois();
if (rois.length > 0) {
Extent extent = rois[0].getRoiImages()[0].getExtent();
ISize isize = rois[0].getISize();
int numROIX = rois[0].getISize().getX();
int numROIY = rois[0].getISize().getY();
roiFieldData = new short[numROIX * numROIY];
short regionCounter = 1;
for (int roiIdx = FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING1.ordinal(); roiIdx < rois.length; roiIdx++) {
short[] roiImg = rois[roiIdx].getPixelsXYZ();
for (int pixelIdx = 0; pixelIdx < (numROIX * numROIY); pixelIdx++) {
if (roiImg[pixelIdx] > 0) {
roiFieldData[pixelIdx] = regionCounter;
}
}
regionCounter++;
}
// create field data
int NumTimePoints = 1;
// 8 rois integrated into 1 image
int NumChannels = 1;
short[][][] pixData = new short[NumTimePoints][NumChannels][];
pixData[0][0] = roiFieldData;
// get extental data id
ExternalDataIdentifier newROIExtDataID = FRAPStudy.createNewExternalDataInfo(localWorkspace, FRAPStudy.ROI_SUMDATA_NAME).getExternalDataIdentifier();
CartesianMesh cartesianMesh;
try {
cartesianMesh = getCartesianMesh();
Origin origin = new Origin(0, 0, 0);
FieldDataFileOperationSpec fdos = new FieldDataFileOperationSpec();
fdos.opType = FieldDataFileOperationSpec.FDOS_ADD;
fdos.cartesianMesh = cartesianMesh;
fdos.shortSpecData = pixData;
fdos.specEDI = newROIExtDataID;
fdos.varNames = new String[] { "roiSumDataVar" };
fdos.owner = LocalWorkspace.getDefaultOwner();
fdos.times = new double[] { 0.0 };
fdos.variableTypes = new VariableType[] { VariableType.VOLUME };
fdos.origin = origin;
fdos.extent = extent;
fdos.isize = isize;
localWorkspace.getDataSetControllerImpl().fieldDataFileOperation(fdos);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new ROIDataGenerator(ROI_EXTDATA_NAME, /*name*/
new int[] { 0 }, /* volumePoints*/
new int[0], /* membranePoints*/
regionCounter, /*numRegions*/
0, /*zSlice*/
newROIExtDataID.getKey(), /* fieldDataKey, sample image*/
new FieldFunctionArguments(FRAPStudy.ROI_SUMDATA_NAME, "roiSumDataVar", new Expression(0), VariableType.VOLUME), /*FieldFunctionArguments, sample image*/
false);
}
return null;
}
use of org.vcell.util.ISize in project vcell by virtualcell.
the class MeshSpecification method getVCML.
/**
* This method was created by a SmartGuide.
* @return java.lang.String
*/
public String getVCML() {
StringBuffer buffer = new StringBuffer();
buffer.append(VCML.MeshSpecification + " {\n");
ISize size = getSamplingSize();
buffer.append("\t" + VCML.Size + " " + size.getX() + " " + size.getY() + " " + size.getZ() + "\n");
buffer.append("}\n");
return buffer.toString();
}
use of org.vcell.util.ISize in project vcell by virtualcell.
the class XmlReader method getMeshSpecification.
/**
* This method returns a MeshSpecification object from a XML Element.
* Creation date: (5/22/2001 12:05:21 PM)
* @return cbit.vcell.mesh.MeshSpecification
* @param param org.jdom.Element
*/
private MeshSpecification getMeshSpecification(Element param, Geometry geometry) throws XmlParseException {
// *** create new MeshSpecification ***
MeshSpecification meshSpec = new MeshSpecification(geometry);
// get ISize
Element size = param.getChild(XMLTags.SizeTag, vcNamespace);
int x = Integer.parseInt(size.getAttributeValue(XMLTags.XAttrTag));
int y = Integer.parseInt(size.getAttributeValue(XMLTags.YAttrTag));
int z = Integer.parseInt(size.getAttributeValue(XMLTags.ZAttrTag));
ISize newsize = new ISize(x, y, z);
// set ISize
try {
meshSpec.setSamplingSize(newsize);
} catch (java.beans.PropertyVetoException e) {
e.printStackTrace();
throw new XmlParseException("A PropertyVetoException was fired when setting the ISize object to a new MeshSpecification", e);
}
return meshSpec;
}
use of org.vcell.util.ISize in project vcell by virtualcell.
the class Xmlproducer method getXML.
private Element getXML(GeometrySurfaceDescription param) throws XmlParseException {
Element gsd = new Element(XMLTags.SurfaceDescriptionTag);
// add attributes
ISize isize = param.getVolumeSampleSize();
if (isize == null) {
throw new XmlParseException("Unable to retrieve dimensions for surface descriptions for Geometry: " + param.getGeometry().getName());
}
gsd.setAttribute(XMLTags.NumSamplesXAttrTag, String.valueOf(isize.getX()));
gsd.setAttribute(XMLTags.NumSamplesYAttrTag, String.valueOf(isize.getY()));
gsd.setAttribute(XMLTags.NumSamplesZAttrTag, String.valueOf(isize.getZ()));
Double coFrequency = param.getFilterCutoffFrequency();
if (coFrequency == null) {
throw new XmlParseException("Unable to retrieve cutoff frequency for surface descriptions for Geometry: " + param.getGeometry().getName());
}
double cutoffFrequency = coFrequency.doubleValue();
gsd.setAttribute(XMLTags.CutoffFrequencyAttrTag, String.valueOf(cutoffFrequency));
// add subelements
GeometricRegion[] geomRegions = param.getGeometricRegions();
if (geomRegions != null) {
for (int i = 0; i < geomRegions.length; i++) {
if (geomRegions[i] instanceof SurfaceGeometricRegion) {
SurfaceGeometricRegion sgr = (SurfaceGeometricRegion) geomRegions[i];
Element membraneRegion = new Element(XMLTags.MembraneRegionTag);
membraneRegion.setAttribute(XMLTags.NameAttrTag, sgr.getName());
GeometricRegion[] adjacents = sgr.getAdjacentGeometricRegions();
if (adjacents == null || adjacents.length != 2) {
throw new XmlParseException("Wrong number of adjacent regions for surface descriptions for location: " + sgr.getName() + " in Geometry: " + param.getGeometry().getName());
}
membraneRegion.setAttribute(XMLTags.VolumeRegion_1AttrTag, adjacents[0].getName());
membraneRegion.setAttribute(XMLTags.VolumeRegion_2AttrTag, adjacents[1].getName());
double size = sgr.getSize();
if (size != -1) {
membraneRegion.setAttribute(XMLTags.SizeAttrTag, String.valueOf(size));
VCUnitDefinition unit = sgr.getSizeUnit();
if (unit != null) {
membraneRegion.setAttribute(XMLTags.VCUnitDefinitionAttrTag, unit.getSymbol());
}
}
gsd.addContent(membraneRegion);
} else if (geomRegions[i] instanceof VolumeGeometricRegion) {
VolumeGeometricRegion vgr = (VolumeGeometricRegion) geomRegions[i];
Element volumeRegion = new Element(XMLTags.VolumeRegionTag);
volumeRegion.setAttribute(XMLTags.NameAttrTag, vgr.getName());
volumeRegion.setAttribute(XMLTags.RegionIDAttrTag, String.valueOf(vgr.getRegionID()));
volumeRegion.setAttribute(XMLTags.SubVolumeAttrTag, vgr.getSubVolume().getName());
double size = vgr.getSize();
if (size != -1) {
volumeRegion.setAttribute(XMLTags.SizeAttrTag, String.valueOf(size));
VCUnitDefinition unit = vgr.getSizeUnit();
if (unit != null) {
volumeRegion.setAttribute(XMLTags.VCUnitDefinitionAttrTag, unit.getSymbol());
}
}
gsd.addContent(volumeRegion);
}
}
}
return gsd;
}
use of org.vcell.util.ISize in project vcell by virtualcell.
the class Xmlproducer method getXML.
/**
* Insert the method's description here.
* Creation date: (3/3/2001 12:24:59 AM)
* @return Element
* @param param cbit.vcell.mesh.MeshSpecification
*/
private Element getXML(MeshSpecification param) {
Element meshspec = new Element(XMLTags.MeshSpecTag);
Element size = new Element(XMLTags.SizeTag);
// Add extent attributes
ISize sampling = param.getSamplingSize();
size.setAttribute(XMLTags.XAttrTag, String.valueOf(sampling.getX()));
size.setAttribute(XMLTags.YAttrTag, String.valueOf(sampling.getY()));
size.setAttribute(XMLTags.ZAttrTag, String.valueOf(sampling.getZ()));
meshspec.addContent(size);
return meshspec;
}
Aggregations