-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathTestRealDataBoundingBox.java
More file actions
83 lines (71 loc) · 3.31 KB
/
Copy pathTestRealDataBoundingBox.java
File metadata and controls
83 lines (71 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*-
* #%L
* Software for the reconstruction of multi-view microscopic acquisitions
* like Selective Plane Illumination Microscopy (SPIM) Data.
* %%
* Copyright (C) 2012 - 2024 Multiview Reconstruction developers.
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/
package net.preibisch.mvrecon.headless.boundingbox;
import java.net.URI;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutorService;
import ij.ImageJ;
import mpicbg.spim.data.SpimDataException;
import mpicbg.spim.data.sequence.ViewId;
import net.imglib2.img.array.ArrayImgFactory;
import net.imglib2.type.numeric.real.FloatType;
import net.preibisch.legacy.io.IOFunctions;
import net.preibisch.mvrecon.fiji.plugin.boundingbox.MinFilterThresholdBoundingBoxGUI;
import net.preibisch.mvrecon.fiji.plugin.fusion.FusionGUI.FusionType;
import net.preibisch.mvrecon.fiji.spimdata.SpimData2;
import net.preibisch.mvrecon.fiji.spimdata.XmlIoSpimData2;
import net.preibisch.mvrecon.fiji.spimdata.boundingbox.BoundingBox;
import net.preibisch.mvrecon.process.boundingbox.BoundingBoxMinFilterThreshold;
import net.preibisch.mvrecon.process.deconvolution.DeconViews;
import net.preibisch.mvrecon.process.fusion.FusionTools;
public class TestRealDataBoundingBox
{
public static void main( String[] args ) throws SpimDataException
{
new ImageJ();
// one common ExecutorService for all
final ExecutorService service = DeconViews.createExecutorService();
// test a real scenario
final SpimData2 spimData = new XmlIoSpimData2().load( URI.create( "/Users/spreibi/Documents/Microscopy/SPIM/HisYFP-SPIM/dataset.xml" ) );
final List< ViewId > viewIds = new ArrayList< ViewId >();
viewIds.addAll( spimData.getSequenceDescription().getViewDescriptions().values() );
// filter not present ViewIds
final List< ViewId > removed = SpimData2.filterMissingViews( spimData, viewIds );
IOFunctions.println( new Date( System.currentTimeMillis() ) + ": Removed " + removed.size() + " views because they are not present." );
System.out.println( viewIds.size() + " views in total." );
final BoundingBoxMinFilterThreshold estimation = new BoundingBoxMinFilterThreshold(
spimData,
service,
viewIds,
new ArrayImgFactory<>( new FloatType() ),
MinFilterThresholdBoundingBoxGUI.defaultBackgroundIntensity,
MinFilterThresholdBoundingBoxGUI.defaultDiscardedObjectSize,
true,
8 );
final BoundingBox bb = estimation.estimate( "MinFilterThresholdBoundingBoxGUI" );
service.shutdown();
FusionTools.displayCopy( FusionTools.fuseVirtual( spimData, viewIds, FusionType.AVG_BLEND, 1, FusionTools.defaultBlendingRange, bb, null ), estimation.getMinIntensity(), estimation.getMaxIntensity() ).show();
}
}