@@ -169,7 +169,7 @@ class Processor { MEMALIGN(Processor)
169
169
int npeaks,
170
170
vector<Direction> true_peaks,
171
171
value_type threshold,
172
- Image<value_type>* ipeaks_data,
172
+ Image<value_type> ipeaks_data,
173
173
bool use_precomputer) :
174
174
dirs_vox (dirs_data),
175
175
dirs (directions),
@@ -210,17 +210,17 @@ class Processor { MEMALIGN(Processor)
210
210
all_peaks.push_back (p);
211
211
}
212
212
213
- if (ipeaks_vox) {
214
- ipeaks_vox-> index (0 ) = item.pos [0 ];
215
- ipeaks_vox-> index (1 ) = item.pos [1 ];
216
- ipeaks_vox-> index (2 ) = item.pos [2 ];
213
+ if (ipeaks_vox. valid () ) {
214
+ ipeaks_vox. index (0 ) = item.pos [0 ];
215
+ ipeaks_vox. index (1 ) = item.pos [1 ];
216
+ ipeaks_vox. index (2 ) = item.pos [2 ];
217
217
218
218
for (int i = 0 ; i < npeaks; i++) {
219
219
Eigen::Vector3f p;
220
- ipeaks_vox-> index (3 ) = 3 *i;
220
+ ipeaks_vox. index (3 ) = 3 *i;
221
221
for (int n = 0 ; n < 3 ; n++) {
222
- p[n] = ipeaks_vox-> value ();
223
- ipeaks_vox-> index (3 )++;
222
+ p[n] = ipeaks_vox. value ();
223
+ ipeaks_vox. index (3 )++;
224
224
}
225
225
p.normalize ();
226
226
@@ -270,16 +270,16 @@ class Processor { MEMALIGN(Processor)
270
270
vector<Direction> true_peaks;
271
271
value_type threshold;
272
272
vector<Direction> peaks_out;
273
- copy_ptr< Image<value_type> > ipeaks_vox;
273
+ Image<value_type> ipeaks_vox;
274
274
Math::SH::PrecomputedAL<value_type>* precomputer;
275
275
276
276
bool check_input (const Item& item) {
277
- if (ipeaks_vox) {
278
- ipeaks_vox-> index (0 ) = item.pos [0 ];
279
- ipeaks_vox-> index (1 ) = item.pos [1 ];
280
- ipeaks_vox-> index (2 ) = item.pos [2 ];
281
- ipeaks_vox-> index (3 ) = 0 ;
282
- if (std::isnan (value_type (ipeaks_vox-> value ())))
277
+ if (ipeaks_vox. valid () ) {
278
+ ipeaks_vox. index (0 ) = item.pos [0 ];
279
+ ipeaks_vox. index (1 ) = item.pos [1 ];
280
+ ipeaks_vox. index (2 ) = item.pos [2 ];
281
+ ipeaks_vox. index (3 ) = 0 ;
282
+ if (std::isnan (value_type (ipeaks_vox. value ())))
283
283
return true ;
284
284
}
285
285
@@ -339,22 +339,22 @@ void run ()
339
339
header.datatype () = DataType::Float32;
340
340
341
341
opt = get_options (" peaks" );
342
- std::unique_ptr< Image<value_type> > ipeaks_data;
342
+ Image<value_type> ipeaks_data;
343
343
if (opt.size ()) {
344
344
if (true_peaks.size ())
345
345
throw Exception (" you can't specify both a peaks file and orientations to be estimated at the same time" );
346
346
if (opt.size ())
347
- ipeaks_data. reset ( new Image<value_type> (Image<value_type>::open (opt[0 ][0 ]) ));
347
+ ipeaks_data = Image<value_type> (Image<value_type>::open (opt[0 ][0 ]));
348
348
349
- check_dimensions (SH_data, * ipeaks_data, 0 , 3 );
350
- npeaks = ipeaks_data-> size (3 ) / 3 ;
349
+ check_dimensions (SH_data, ipeaks_data, 0 , 3 );
350
+ npeaks = ipeaks_data. size (3 ) / 3 ;
351
351
}
352
352
header.size (3 ) = 3 * npeaks;
353
353
auto peaks = Image<value_type>::create (argument[1 ], header);
354
354
355
355
DataLoader loader (SH_data, mask_data.get ());
356
356
Processor processor (peaks, dirs, Math::SH::LforN (SH_data.size (3 )),
357
- npeaks, true_peaks, threshold, ipeaks_data. get () , get_options (" fast" ).size ());
357
+ npeaks, true_peaks, threshold, ipeaks_data, get_options (" fast" ).size ());
358
358
359
359
Thread::run_queue (loader, Thread::batch (Item ()), Thread::multi (processor));
360
360
}
0 commit comments