use of org.vcell.util.document.ExternalDataIdentifier in project vcell by virtualcell.
the class XmlReader method getDataSymbols.
private ArrayList<DataSymbol> getDataSymbols(Element dataContextElement, DataContext dataContext, ModelUnitSystem modelUnitSystem) {
ArrayList<DataSymbol> dataSymbolsList = new ArrayList<DataSymbol>();
// iterate over fieldDatasymbols. When other dataSymbol types are implemented, repeat this loop.
Iterator dataSymbolsElementIter = dataContextElement.getChildren(XMLTags.FieldDataSymbolTag, vcNamespace).iterator();
while (dataSymbolsElementIter.hasNext()) {
Element dataSymbolElement = (Element) dataSymbolsElementIter.next();
String dataSymbolName = unMangle(dataSymbolElement.getAttributeValue(XMLTags.DataSymbolNameTag));
DataSymbolType dataSymbolType = DataSymbolType.fromDatabaseName(unMangle(dataSymbolElement.getAttributeValue(XMLTags.DataSymbolTypeTag)));
String symbol = dataSymbolElement.getAttributeValue(XMLTags.VCUnitDefinitionAttrTag);
VCUnitDefinition vcUnitDefinition = null;
if (symbol != null) {
vcUnitDefinition = modelUnitSystem.getInstance(symbol);
}
// ExternalDataIdentifier dataSetID in FieldDataSymbol
Element dataSetIDElement = dataSymbolElement.getChild(XMLTags.ExternalDataIdentifierTag, vcNamespace);
String name = unMangle(dataSetIDElement.getAttributeValue(XMLTags.NameAttrTag));
String key = unMangle(dataSetIDElement.getAttributeValue(XMLTags.KeyValueAttrTag));
String userID = unMangle(dataSetIDElement.getAttributeValue(XMLTags.OwnerNameAttrTag));
String userKey = unMangle(dataSetIDElement.getAttributeValue(XMLTags.OwnerKeyAttrTag));
User owner = new User(userID, new KeyValue(userKey));
ExternalDataIdentifier edi = new ExternalDataIdentifier(new KeyValue(key), owner, name);
// ---
String fieldItemName = unMangle(dataSymbolElement.getAttributeValue(XMLTags.FieldItemNameTag));
String fieldItemType = unMangle(dataSymbolElement.getAttributeValue(XMLTags.FieldItemTypeTag));
double fieldItemTime = Double.parseDouble(unMangle(dataSymbolElement.getAttributeValue(XMLTags.FieldItemTimeTag)));
FieldDataSymbol fds = new FieldDataSymbol(dataSymbolName, dataSymbolType, dataContext, vcUnitDefinition, edi, fieldItemName, fieldItemType, fieldItemTime);
dataSymbolsList.add(fds);
}
return dataSymbolsList;
}
use of org.vcell.util.document.ExternalDataIdentifier in project vcell by virtualcell.
the class FRAPStudy method createNewExternalDataInfo.
public static ExternalDataInfo createNewExternalDataInfo(LocalWorkspace localWorkspace, String extDataIDName) {
File targetDir = new File(localWorkspace.getDefaultSimDataDirectory());
ExternalDataIdentifier newImageDataExtDataID = new ExternalDataIdentifier(LocalWorkspace.createNewKeyValue(), LocalWorkspace.getDefaultOwner(), extDataIDName);
ExternalDataInfo newImageDataExtDataInfo = new ExternalDataInfo(newImageDataExtDataID, new File(targetDir, newImageDataExtDataID.getID() + SimDataConstants.LOGFILE_EXTENSION).getAbsolutePath());
return newImageDataExtDataInfo;
}
use of org.vcell.util.document.ExternalDataIdentifier 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.document.ExternalDataIdentifier in project vcell by virtualcell.
the class MicroscopyXmlReader method getExternalDataInfo.
private static ExternalDataInfo getExternalDataInfo(Element extDataInfoElement) {
String filename = extDataInfoElement.getAttributeValue(MicroscopyXMLTags.FilenameAttrTag);
Element externalDataIDElement = extDataInfoElement.getChild(MicroscopyXMLTags.ExternalDataIdentifierTag);
ExternalDataIdentifier externalDataID = getExternalDataIdentifier(externalDataIDElement);
ExternalDataInfo externalDataInfo = new ExternalDataInfo(externalDataID, filename);
return externalDataInfo;
}
use of org.vcell.util.document.ExternalDataIdentifier in project vcell by virtualcell.
the class ROIDataGenerator method getSampleImageFieldData.
public FieldDataIdentifierSpec getSampleImageFieldData(User user) {
// key
String key = fieldDataKey.toString();
String fieldInput = fieldFuncArguments.infix();
StringTokenizer st = null;
int index = fieldInput.indexOf(FieldFunctionDefinition.FUNCTION_name);
if (index >= 0) {
st = new StringTokenizer(fieldInput.substring(index), "\n");
if (st.hasMoreTokens()) {
String fieldFunction = st.nextToken();
try {
Expression exp = new Expression(fieldFunction);
FieldFunctionArguments[] ffa = FieldUtilities.getFieldFunctionArguments(exp);
return new FieldDataIdentifierSpec(ffa[0], new ExternalDataIdentifier(KeyValue.fromString(key), user, ffa[0].getFieldName()));
} catch (ExpressionException e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Failed to load data processing script.");
}
}
}
return null;
}
Aggregations