Skip to content

Commit 700d30d

Browse files
committed
sh2peaks: remove use of copy_ptr
Fixes #2148
1 parent 7964bd5 commit 700d30d

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

cmd/sh2peaks.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class Processor { MEMALIGN(Processor)
169169
int npeaks,
170170
vector<Direction> true_peaks,
171171
value_type threshold,
172-
Image<value_type>* ipeaks_data,
172+
Image<value_type> ipeaks_data,
173173
bool use_precomputer) :
174174
dirs_vox (dirs_data),
175175
dirs (directions),
@@ -210,17 +210,17 @@ class Processor { MEMALIGN(Processor)
210210
all_peaks.push_back (p);
211211
}
212212

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];
217217

218218
for (int i = 0; i < npeaks; i++) {
219219
Eigen::Vector3f p;
220-
ipeaks_vox->index(3) = 3*i;
220+
ipeaks_vox.index(3) = 3*i;
221221
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)++;
224224
}
225225
p.normalize();
226226

@@ -270,16 +270,16 @@ class Processor { MEMALIGN(Processor)
270270
vector<Direction> true_peaks;
271271
value_type threshold;
272272
vector<Direction> peaks_out;
273-
copy_ptr<Image<value_type> > ipeaks_vox;
273+
Image<value_type> ipeaks_vox;
274274
Math::SH::PrecomputedAL<value_type>* precomputer;
275275

276276
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())))
283283
return true;
284284
}
285285

@@ -339,22 +339,22 @@ void run ()
339339
header.datatype() = DataType::Float32;
340340

341341
opt = get_options ("peaks");
342-
std::unique_ptr<Image<value_type> > ipeaks_data;
342+
Image<value_type> ipeaks_data;
343343
if (opt.size()) {
344344
if (true_peaks.size())
345345
throw Exception ("you can't specify both a peaks file and orientations to be estimated at the same time");
346346
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]));
348348

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;
351351
}
352352
header.size(3) = 3 * npeaks;
353353
auto peaks = Image<value_type>::create (argument[1], header);
354354

355355
DataLoader loader (SH_data, mask_data.get());
356356
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());
358358

359359
Thread::run_queue (loader, Thread::batch (Item()), Thread::multi (processor));
360360
}

0 commit comments

Comments
 (0)