@@ -122,8 +122,9 @@ class Item { MEMALIGN(Item)
122
122
class DataLoader { MEMALIGN(DataLoader)
123
123
public:
124
124
DataLoader (Image<value_type>& sh_data,
125
- Image<bool >* mask_data) :
125
+ const Image<bool >& mask_data) :
126
126
sh (sh_data),
127
+ mask (mask_data),
127
128
loop (Loop(" estimating peak directions" , 0 , 3 ) (sh)) { }
128
129
129
130
bool operator () (Item& item) {
@@ -133,9 +134,9 @@ class DataLoader { MEMALIGN(DataLoader)
133
134
item.pos [1 ] = sh.index (1 );
134
135
item.pos [2 ] = sh.index (2 );
135
136
136
- if (mask) {
137
- assign_pos_of (sh).to (* mask);
138
- if (!mask-> value ()) {
137
+ if (mask. valid () ) {
138
+ assign_pos_of (sh).to (mask);
139
+ if (!mask. value ()) {
139
140
for (auto l = Loop (3 ) (sh); l; ++l)
140
141
item.data [sh.index (3 )] = NaN;
141
142
}
@@ -154,7 +155,7 @@ class DataLoader { MEMALIGN(DataLoader)
154
155
155
156
private:
156
157
Image<value_type> sh;
157
- std::unique_ptr< Image<bool > > mask;
158
+ Image<bool > mask;
158
159
LoopAlongAxisRangeProgress::Run<Image<value_type> > loop;
159
160
};
160
161
@@ -308,9 +309,9 @@ void run ()
308
309
309
310
auto opt = get_options (" mask" );
310
311
311
- std::unique_ptr< Image<bool > > mask_data;
312
+ Image<bool > mask_data;
312
313
if (opt.size ())
313
- mask_data. reset ( new Image<bool >(Image< bool > ::open (opt[0 ][0 ])) );
314
+ mask_data = Image<bool >::open (opt[0 ][0 ]);
314
315
315
316
opt = get_options (" seeds" );
316
317
Eigen::Matrix<value_type, Eigen::Dynamic, 2 > dirs;
@@ -344,15 +345,15 @@ void run ()
344
345
if (true_peaks.size ())
345
346
throw Exception (" you can't specify both a peaks file and orientations to be estimated at the same time" );
346
347
if (opt.size ())
347
- ipeaks_data = Image<value_type> (Image<value_type> ::open (opt[0 ][0 ]) );
348
+ ipeaks_data = Image<value_type>::open (opt[0 ][0 ]);
348
349
349
350
check_dimensions (SH_data, ipeaks_data, 0 , 3 );
350
351
npeaks = ipeaks_data.size (3 ) / 3 ;
351
352
}
352
353
header.size (3 ) = 3 * npeaks;
353
354
auto peaks = Image<value_type>::create (argument[1 ], header);
354
355
355
- DataLoader loader (SH_data, mask_data. get () );
356
+ DataLoader loader (SH_data, mask_data);
356
357
Processor processor (peaks, dirs, Math::SH::LforN (SH_data.size (3 )),
357
358
npeaks, true_peaks, threshold, ipeaks_data, get_options (" fast" ).size ());
358
359
0 commit comments