|
21 | 21 | */ |
22 | 22 | package fiji.plugin.trackmate.gui; |
23 | 23 |
|
| 24 | + |
24 | 25 | import java.awt.Color; |
25 | 26 | import java.awt.Component; |
26 | 27 | import java.awt.Desktop; |
|
62 | 63 | import org.scijava.prefs.PrefService; |
63 | 64 |
|
64 | 65 | import fiji.plugin.trackmate.util.TMUtils; |
| 66 | +import fiji.plugin.trackmate.Settings; |
65 | 67 | import ij.IJ; |
66 | 68 | import ij.ImagePlus; |
67 | 69 | import ij.measure.Calibration; |
@@ -255,6 +257,44 @@ public static final void userCheckImpDimensions( final ImagePlus imp ) |
255 | 257 | } |
256 | 258 | } |
257 | 259 | } |
| 260 | + |
| 261 | + /** |
| 262 | + * Check if the image dimensions and the dimensions in the settings match |
| 263 | + * @param imp movie to check Z and T dimensions |
| 264 | + * @param settings settings loaded from TrackMate file |
| 265 | + */ |
| 266 | + public static final void checkDimensionsImpAndSettings( final ImagePlus imp, final Settings settings ) |
| 267 | + { |
| 268 | + final int[] dims = imp.getDimensions(); |
| 269 | + // dimension of image and .xml metadata match, don't do anything |
| 270 | + if ( ( settings.nslices == dims[3] ) && ( settings.nframes == dims[4] ) ) |
| 271 | + return; |
| 272 | + |
| 273 | + if ( dims[ 4 ] == 1 && dims[ 3 ] > 1 ) |
| 274 | + { |
| 275 | + switch ( JOptionPane.showConfirmDialog( null, |
| 276 | + "It appears this image has 1 timepoint but " |
| 277 | + + dims[ 3 ] |
| 278 | + + " slices.\n" |
| 279 | + + "Do you want to swap Z and T?", |
| 280 | + "Z/T swapped?", JOptionPane.YES_NO_CANCEL_OPTION ) ) |
| 281 | + { |
| 282 | + case JOptionPane.YES_OPTION: |
| 283 | + imp.setDimensions( dims[ 2 ], dims[ 4 ], dims[ 3 ] ); |
| 284 | + final Calibration calibration = imp.getCalibration(); |
| 285 | + if ( 0. == calibration.frameInterval ) |
| 286 | + { |
| 287 | + calibration.frameInterval = 1; |
| 288 | + calibration.setTimeUnit( "frame" ); |
| 289 | + } |
| 290 | + break; |
| 291 | + |
| 292 | + case JOptionPane.CANCEL_OPTION: |
| 293 | + return; |
| 294 | + } |
| 295 | + } |
| 296 | + } |
| 297 | + |
258 | 298 |
|
259 | 299 | public static void setSystemLookAndFeel() |
260 | 300 | { |
|
0 commit comments