use of cbit.vcell.VirtualMicroscopy.ImageDataset in project vcell by virtualcell.
the class DefineROI_SummaryPanel method setLoadInfo.
public void setLoadInfo(final FRAPStudy frapStudy) {
if (frapStudy != null && frapStudy.getFrapData() != null) {
// enable components to change values
BeanUtils.enableComponents(getInfoPanel(), true);
BeanUtils.enableComponents(getIndexPanel(), true);
// set info panel
ImageDataset imgDataset = frapStudy.getFrapData().getImageDataset();
imgXTextField.setText(NumberUtils.formatNumber(imgDataset.getExtent().getX(), 15));
imgYTextField.setText(NumberUtils.formatNumber(imgDataset.getExtent().getY(), 15));
FRAPData fData = frapStudy.getFrapData();
ROI cellROI = fData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name());
ROI bleachedROI = fData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED.name());
ROI backgroundROI = fData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BACKGROUND.name());
if (cellROI.getNonzeroPixelsCount() < 1) {
cellROIUndefined.setSelected(true);
cellROIDefined.setSelected(false);
} else {
cellROIUndefined.setSelected(false);
cellROIDefined.setSelected(true);
}
if (bleachedROI.getNonzeroPixelsCount() < 1) {
bleachROIUndefined.setSelected(true);
bleachROIDefined.setSelected(false);
} else {
bleachROIUndefined.setSelected(false);
bleachROIDefined.setSelected(true);
}
if (backgroundROI.getNonzeroPixelsCount() < 1) {
bgROIUndefined.setSelected(true);
bgROIDefined.setSelected(false);
} else {
bgROIUndefined.setSelected(false);
bgROIDefined.setSelected(true);
}
// they are not editable
imgXTextField.setEditable(false);
imgYTextField.setEditable(false);
cellROIDefined.setEnabled(false);
cellROIUndefined.setEnabled(false);
bleachROIDefined.setEnabled(false);
bleachROIUndefined.setEnabled(false);
bgROIDefined.setEnabled(false);
bgROIUndefined.setEnabled(false);
// set index panel
startIndexCombo.removeAllItems();
double[] timeSteps = frapStudy.getFrapData().getImageDataset().getImageTimeStamps();
for (int i = 0; i < timeSteps.length; i++) {
startIndexCombo.addItem(timeSteps[i] + "");
}
if (bleachROIDefined.isSelected()) {
int index = (frapStudy.getStartingIndexForRecovery() == null ? FRAPDataAnalysis.calculateRecoveryIndex(frapStudy.getFrapData()) : frapStudy.getStartingIndexForRecovery());
startIndexCombo.setSelectedIndex(index);
startIndexAvaliableLabel.setText(START_IDX_AVAILABLE_STR);
} else {
startIndexCombo.setSelectedIndex(0);
startIndexAvaliableLabel.setText(START_IDX_UNAVAILABLE_STR);
}
} else {
imgXTextField.setText("");
imgYTextField.setText("");
cellROIDefined.setSelected(false);
cellROIUndefined.setSelected(false);
bleachROIDefined.setSelected(false);
bleachROIUndefined.setSelected(false);
bgROIDefined.setSelected(false);
bgROIUndefined.setSelected(false);
startIndexCombo.removeAllItems();
startIndexCombo.addItem(" N/A ");
BeanUtils.enableComponents(getInfoPanel(), false);
BeanUtils.enableComponents(getIndexPanel(), false);
}
}
use of cbit.vcell.VirtualMicroscopy.ImageDataset in project vcell by virtualcell.
the class LoadFRAPData_SummaryPanel method setLoadInfo.
public void setLoadInfo(final FRAPStudy frapStudy) {
if (frapStudy != null && frapStudy.getFrapData() != null) {
BeanUtils.enableComponents(getTimePanel(), true);
BeanUtils.enableComponents(getTimePanel(), true);
// title
loadInfo.setText(loadSuccessInfo);
// time
sTimeCombo.removeAllItems();
eTimeCombo.removeAllItems();
double[] timeSteps = frapStudy.getFrapData().getImageDataset().getImageTimeStamps();
for (int i = 0; i < timeSteps.length; i++) {
sTimeCombo.addItem(timeSteps[i] + "");
eTimeCombo.addItem(timeSteps[i] + "");
}
sTimeCombo.setSelectedIndex(0);
eTimeCombo.setSelectedIndex(timeSteps.length - 1);
totTimeLabel.setText((timeSteps[timeSteps.length - 1] - timeSteps[0]) + "");
ImageDataset imgDataset = frapStudy.getFrapData().getImageDataset();
int numXPixels = imgDataset.getAllImages()[0].getNumX();
int numYPixels = imgDataset.getAllImages()[0].getNumY();
numXPixelsValLabel.setText(numXPixels + "");
numYPixelsValLabel.setText(numYPixels + "");
double pixelSizeX = imgDataset.getExtent().getX() / numXPixels;
double pixelSizeY = imgDataset.getExtent().getY() / numYPixels;
imgPixelSizeX.setText(NumberUtils.formatNumber(pixelSizeX, 10));
imgPixelSizeY.setText(NumberUtils.formatNumber(pixelSizeY, 10));
} else {
// title
loadInfo.setText(loadFailedInfo);
// time
sTimeCombo.removeAllItems();
sTimeCombo.addItem(" N/A ");
eTimeCombo.removeAllItems();
eTimeCombo.addItem(" N/A ");
totTimeLabel.setText("");
numXPixelsValLabel.setText("");
numYPixelsValLabel.setText("");
imgPixelSizeX.setText("");
imgPixelSizeY.setText("");
BeanUtils.enableComponents(getSizePanel(), false);
BeanUtils.enableComponents(getTimePanel(), false);
}
}
use of cbit.vcell.VirtualMicroscopy.ImageDataset in project vcell by virtualcell.
the class ROIMultiPaintManager method initImageDataSet.
private void initImageDataSet(short[][] dataToSegmentChannels, ISize uncroppedISize) throws Exception {
initImageDataSetChannels = new ImageDataset[(dataToSegmentChannels != null ? dataToSegmentChannels.length : 1)];
for (int c = 0; c < initImageDataSetChannels.length; c++) {
UShortImage[] zImageSet = new UShortImage[uncroppedISize.getZ()];
for (int i = 0; i < zImageSet.length; i++) {
short[] shortData = new short[uncroppedISize.getX() * uncroppedISize.getY()];
if (dataToSegmentChannels != null) {
System.arraycopy(dataToSegmentChannels[c], shortData.length * i, shortData, 0, shortData.length);
}
zImageSet[i] = new UShortImage(shortData, DEFAULT_ORIGIN, DEFAULT_EXTENT, uncroppedISize.getX(), uncroppedISize.getY(), 1);
}
initImageDataSetChannels[c] = new ImageDataset(zImageSet, new double[] { 0.0 }, uncroppedISize.getZ());
}
}
use of cbit.vcell.VirtualMicroscopy.ImageDataset in project vcell by virtualcell.
the class ExportRawTimeSeriesToVFrapOp method exportToVFRAP.
public void exportToVFRAP(File vfrapFile, ImageTimeSeries<UShortImage> imageTimeSeries, ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
Xmlproducer vcellXMLProducer = new Xmlproducer(false);
boolean bSaveCompressed = true;
ImageDataset imageData = new ImageDataset(imageTimeSeries.getAllImages(), imageTimeSeries.getImageTimeStamps(), imageTimeSeries.getSizeZ());
Element root = new Element(MicroscopyXMLTags.FRAPStudyTag);
Element next = new Element(MicroscopyXMLTags.FRAPDataTag);
root.addContent(next);
Element imageDataXML = MicroscopyXmlproducer.getXML(imageData, vcellXMLProducer, clientTaskStatusSupport, bSaveCompressed);
next.addContent(imageDataXML);
java.io.FileOutputStream fileOutStream = new java.io.FileOutputStream(vfrapFile);
BufferedOutputStream bufferedStream = new BufferedOutputStream(fileOutStream);
// XmlUtil.writeXmlToStream(root, false, bufferedStream);
XMLOutputter xmlOut = new XMLOutputter(Format.getPrettyFormat());
xmlOut.getFormat().setTextMode(Format.TextMode.PRESERVE);
xmlOut.output(root, bufferedStream);
bufferedStream.flush();
fileOutStream.flush();
fileOutStream.close();
}
use of cbit.vcell.VirtualMicroscopy.ImageDataset in project vcell by virtualcell.
the class ImportRawTimeSeriesFromExperimentImageOp method importRawTimeSeries.
public ImageTimeSeries<UShortImage> importRawTimeSeries(File expTimeSeriesFile) throws Exception {
ClientTaskStatusSupport clientTaskStatusSupport = null;
ImageDataset rawTimeData = ImageDatasetReaderService.getInstance().getImageDatasetReader().readImageDataset(expTimeSeriesFile.getAbsolutePath(), clientTaskStatusSupport);
ImageTimeSeries<UShortImage> imageTimeSeries = new ImageTimeSeries<UShortImage>(UShortImage.class, rawTimeData.getAllImages(), rawTimeData.getImageTimeStamps(), 1);
return imageTimeSeries;
}
Aggregations