Last active
August 21, 2018 14:39
-
-
Save bogovicj/b538ac9ee9a56ee3065fd0954c686077 to your computer and use it in GitHub Desktop.
concatOpenImages.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @UIService ui | |
// @ImageDisplayService disp | |
// @DatasetService data | |
// @LogService log | |
import java.util.ArrayList; | |
import net.imagej.axis.Axes | |
import net.imglib2.view.Views; | |
import net.imglib2.util.Intervals; | |
import net.imglib2.util.Util; | |
log.info( data.getDatasets( disp.getActiveImageDisplay())) | |
datasets = data.getDatasets() | |
if( datasets.size() == 0 ) | |
{ | |
ui.showDialog("No images found") | |
return | |
} | |
/* | |
* the size of the output will be the union | |
* of the input sizes | |
*/ | |
total_interval = datasets.get( 0 ) | |
for( d in datasets ) | |
{ | |
total_interval = Intervals.union( total_interval, d ) | |
} | |
exp_imgs = new ArrayList(); | |
for( d in datasets ) | |
{ | |
exp_imgs.add( Views.interval( Views.extendZero( d ), total_interval)) | |
} | |
resdata = data.create( Views.stack( exp_imgs )) | |
// set the axis labels | |
resdata.axis(2).setType(Axes.Z) | |
resdata.axis(3).setType(Axes.TIME) | |
ui.show( resdata ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment