use of org.vcell.vcellij.ImageDatasetReader in project vcell by virtualcell.
the class ClientRequestManager method createFDOSFromImageFile.
// public void prepareDocumentToLoad(VCDocument doc) throws Exception {
// Simulation[] simulations = null;
// if (doc instanceof MathModel) {
// Geometry geometry = ((MathModel)doc).getMathDescription().getGeometry();
// geometry.precomputeAll();
// simulations = ((MathModel)doc).getSimulations();
// } else if (doc instanceof Geometry) {
// ((Geometry)doc).precomputeAll();
// } else if (doc instanceof BioModel) {
// BioModel bioModel = (BioModel)doc;
// SimulationContext[] simContexts = bioModel.getSimulationContexts();
// for (SimulationContext simContext : simContexts) {
// simContext.getGeometry().precomputeAll();
// }
// simulations = ((BioModel)doc).getSimulations();
// }
// if (simulations != null) {
// // preload simulation status
// VCSimulationIdentifier simIDs[] = new VCSimulationIdentifier[simulations.length];
// for (int i = 0; i < simulations.length; i++){
// simIDs[i] = simulations[i].getSimulationInfo().getAuthoritativeVCSimulationIdentifier();
// }
// getDocumentManager().preloadSimulationStatus(simIDs);
// }
// }
public static FieldDataFileOperationSpec createFDOSFromImageFile(File imageFile, boolean bCropOutBlack, Integer saveOnlyThisTimePointIndex) throws DataFormatException, ImageException {
try {
ImageDatasetReader imageDatasetReader = ImageDatasetReaderService.getInstance().getImageDatasetReader();
ImageDataset[] imagedataSets = imageDatasetReader.readImageDatasetChannels(imageFile.getAbsolutePath(), null, false, saveOnlyThisTimePointIndex, null);
if (imagedataSets != null && bCropOutBlack) {
for (int i = 0; i < imagedataSets.length; i++) {
Rectangle nonZeroRect = imagedataSets[i].getNonzeroBoundingRectangle();
if (nonZeroRect != null) {
imagedataSets[i] = imagedataSets[i].crop(nonZeroRect);
}
}
}
return createFDOSWithChannels(imagedataSets, null);
} catch (Exception e) {
e.printStackTrace(System.out);
throw new DataFormatException(e.getMessage());
}
}
use of org.vcell.vcellij.ImageDatasetReader in project vcell by virtualcell.
the class NonGUIFRAPTest method readExternalDataContents.
public static ExternalDataFileContents readExternalDataContents(String imageDataPathName, String cellROIPathName, String bleachROIPathName, String backgroundROIPathName) throws Exception {
ExternalDataFileContents extDataFilecontents = new ExternalDataFileContents();
ImageDatasetReader imageDatasetReader = ImageDatasetReaderService.getInstance().getImageDatasetReader();
extDataFilecontents.imageData = imageDatasetReader.readImageDataset(imageDataPathName, null);
extDataFilecontents.cellROIData = imageDatasetReader.readImageDataset(cellROIPathName, null);
extDataFilecontents.bleachROIData = imageDatasetReader.readImageDataset(bleachROIPathName, null);
extDataFilecontents.backgroundROIData = imageDatasetReader.readImageDataset(backgroundROIPathName, null);
return extDataFilecontents;
}
Aggregations