use of mpicbg.spim.data.XmlIoSpimData in project bigwarp by saalfeldlab.
the class ExportTransformAsXmlTest method showFixedAndWarpedMoving.
private static void showFixedAndWarpedMoving(File warpedXml, File fixedImageXml) throws SpimDataException {
final SpimData warpedSpimData = new XmlIoSpimData().load(warpedXml.getAbsolutePath());
final BdvStackSource<?> bdvStackSource = BdvFunctions.show(warpedSpimData).get(0);
bdvStackSource.setDisplayRange(0, 255);
final SpimData fixedSpimData = new XmlIoSpimData().load(fixedImageXml.getAbsolutePath());
final BdvStackSource<?> bdvStackSource2 = BdvFunctions.show(fixedSpimData, BdvOptions.options().addTo(bdvStackSource.getBdvHandle())).get(0);
bdvStackSource2.setDisplayRange(0, 255);
}
use of mpicbg.spim.data.XmlIoSpimData in project bigwarp by saalfeldlab.
the class BigWarpBdvCommand method run.
@Override
public void run() {
try {
final SpimData fixedSpimData = new XmlIoSpimData().load(fixedImageXml.getAbsolutePath());
final SpimData movingSpimData = new XmlIoSpimData().load(movingImageXml.getAbsolutePath());
new RepeatingReleasedEventsFixer().install();
final BigWarp.BigWarpData<?> bigWarpData = BigWarpInit.createBigWarpData(movingSpimData, fixedSpimData);
bw = new BigWarp(bigWarpData, "Big Warp", new ProgressWriterIJ());
bw.getViewerFrameP().getViewerPanel().requestRepaint();
bw.getViewerFrameQ().getViewerPanel().requestRepaint();
bw.getLandmarkFrame().repaint();
bw.setMovingSpimData(movingSpimData, movingImageXml);
} catch (final SpimDataException e) {
e.printStackTrace();
return;
}
}
use of mpicbg.spim.data.XmlIoSpimData in project bigwarp by saalfeldlab.
the class BigWarp method saveMovingImageXml.
public File saveMovingImageXml(String proposedFilePath) {
if (movingSpimData == null) {
IJ.log("Cannot save warped moving image XML, because the input image was not a BDV/XML.");
return null;
}
final AffineTransform3D bigWarpTransform = getMovingToFixedTransformAsAffineTransform3D();
System.out.println("bigWarp transform as affine 3d: " + bigWarpTransform.toString());
movingSpimData.getViewRegistrations().getViewRegistration(0, 0).preconcatenateTransform(new ViewTransformAffine("Big Warp: " + bwTransform.getTransformType(), bigWarpTransform));
File proposedFile;
if (proposedFilePath == null) {
final JFileChooser fileChooser = new JFileChooser(movingImageXml.getParent());
proposedFile = new File(movingImageXml.getName().replace(".xml", "-bigWarp.xml"));
fileChooser.setSelectedFile(proposedFile);
final int returnVal = fileChooser.showSaveDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION)
proposedFile = fileChooser.getSelectedFile();
else
return null;
} else {
proposedFile = new File(proposedFilePath);
}
try {
new XmlIoSpimData().save(movingSpimData, proposedFile.getAbsolutePath());
} catch (SpimDataException e) {
e.printStackTrace();
}
return proposedFile;
}
use of mpicbg.spim.data.XmlIoSpimData in project imagej-utils by embl-cba.
the class ExampleSimpleViewCaptureBehaviour method main.
public static void main(String[] args) throws SpimDataException {
/**
* show first image
*/
final String path = ExampleSimpleViewCaptureBehaviour.class.getResource("../mri-stack.xml").getFile();
SpimData spimData = new XmlIoSpimData().load(path);
final List<BdvStackSource<?>> stackSources = BdvFunctions.show(spimData);
stackSources.get(0).setDisplayRange(0, 255);
final BdvHandle bdv = stackSources.get(0).getBdvHandle();
/**
* add another image
*/
// final IntervalView< UnsignedIntType > img = Views.translate( Utils.create2DGradientImage(), new long[]{ 0, 0, 0 } );
// //
// // final BdvStackSource stackSource = BdvFunctions.show(
// // img, "image 0",
// // BdvOptions.options().addTo( bdv ) );
// // stackSource.setDisplayRange( 0, 300 );
// // stackSource.setColor( new ARGBType( ARGBType.rgba( 0, 255, 0, 0 ) ) );
// //
// // final AffineTransform3D vt = new AffineTransform3D();
// // bdv.getViewerPanel().state().getViewerTransform( vt );
// // vt.set( 0, 2, 3 );
// // bdv.getViewerPanel().setCurrentViewerTransform( vt );
/**
* install view capture behaviour
*/
Behaviours behaviours = new Behaviours(new InputTriggerConfig());
behaviours.install(bdv.getTriggerbindings(), "");
BdvBehaviours.addSimpleViewCaptureBehaviour(bdv, behaviours, "C");
}
use of mpicbg.spim.data.XmlIoSpimData in project imagej-utils by embl-cba.
the class ExampleViewCapture method main.
public static void main(String[] args) throws SpimDataException {
new ImageJ().ui().showUI();
Prefs.showScaleBar(true);
/**
* show first image
*/
String path = ExampleViewCapture.class.getResource("../multi-resolution-mri-stack.xml").getFile();
SpimData spimData = new XmlIoSpimData().load(path);
List<BdvStackSource<?>> stackSources = BdvFunctions.show(spimData, BdvOptions.options().preferredSize(600, 600));
stackSources.get(0).setDisplayRange(0, 255);
stackSources.get(0).setColor(new ARGBType(ARGBType.rgba(255, 0, 0, 255)));
final BdvHandle bdvHandle = stackSources.get(0).getBdvHandle();
/**
* add another image
*/
path = ExampleViewCapture.class.getResource("../mri-stack-shifted.xml").getFile();
spimData = new XmlIoSpimData().load(path);
stackSources = BdvFunctions.show(spimData, BdvOptions.options().addTo(bdvHandle));
stackSources.get(0).setDisplayRange(0, 255);
/**
* also add an ARBGType image
*/
final ArrayImg<UnsignedIntType, IntArray> img = ArrayImgs.unsignedInts(256, 256, 1000);
final ArrayCursor<UnsignedIntType> cursor = img.cursor();
while (cursor.hasNext()) cursor.next().set(cursor.getIntPosition(0));
final RandomAccessibleIntervalSource source = new RandomAccessibleIntervalSource(img, Util.getTypeFromInterval(img), "");
final SelectableVolatileARGBConverter converter = new SelectableVolatileARGBConverter(new LinearARGBConverter(0, 255, Luts.BLUE_WHITE_RED));
final ARGBConvertedRealSource convertedRealSource = new ARGBConvertedRealSource(source, converter);
BdvFunctions.show(convertedRealSource, BdvOptions.options().addTo(bdvHandle));
/**
* capture a view
*/
final ViewCaptureResult captureResult = BdvViewCaptures.captureView(bdvHandle, 1, "micron", true);
captureResult.rawImagesStack.show();
captureResult.rgbImage.show();
}
Aggregations