-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsensus_skeleton_func.cpp
More file actions
687 lines (580 loc) · 22.1 KB
/
Copy pathconsensus_skeleton_func.cpp
File metadata and controls
687 lines (580 loc) · 22.1 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
/* consensus_skeleton_func.cpp
* a plugin to merge multiple neurons by generating a consensus skeleton
* 2012-05-02 : by Yinan Wan
*/
#include <v3d_interface.h>
#include "basic_surf_objs.h"
#include "v3d_message.h"
#include "consensus_skeleton_func.h"
#include "consensus_skeleton.h"
#include "median_swc.h"
#include "dark_pruning.h"
#include <vector>
#include <iostream>
using namespace std;
const QString title = QObject::tr("Consensus Skeleton");
int consensus_swc_menu(V3DPluginCallback2 &callback, QWidget *parent)
{
v3d_msg("Not implemented yet. Please use the command line option.");
return 0;
}
bool vote_map_func(const V3DPluginArgList & input, V3DPluginArgList & output, V3DPluginCallback2 &callback)
{
if(input.size()==0 || output.size() != 1) return false;
char * paras = NULL;
//parsing input
vector<char *> * inlist = (vector<char*> *)(input.at(0).p);
if (inlist->size()==0)
{
cerr<<"You must specify input linker or swc files"<<endl;
return false;
}
//parsing output
vector<char *> * outlist = (vector<char*> *)(output.at(0).p);
if (outlist->size()>1)
{
cerr << "You cannot specify more than 1 output files"<<endl;
return false;
}
vector<NeuronTree> nt_list;
QStringList nameList;
QString qs_linker;
char * dfile_result = NULL;
V3DLONG neuronNum = 0;
for (int i=0;i<inlist->size();i++)
{
qs_linker = QString(inlist->at(i));
if (qs_linker.toUpper().endsWith(".ANO"))
{
cout<<"(0). reading a linker file."<<endl;
P_ObjectFileType linker_object;
if (!loadAnoFile(qs_linker,linker_object))
{
fprintf(stderr,"Error in reading the linker file.\n");
return 1;
}
nameList = linker_object.swc_file_list;
neuronNum += nameList.size();
for (V3DLONG i=0;i<neuronNum;i++)
{
NeuronTree tmp = readSWC_file(nameList.at(i));
nt_list.push_back(tmp);
}
}
else if (qs_linker.toUpper().endsWith(".SWC"))
{
//cout<<"(0). reading an swc file"<<endl;
NeuronTree tmp = readSWC_file(qs_linker);
nt_list.push_back(tmp);
neuronNum++;
if (outlist->size()==0)
{
cerr<<"You must specify outfile name if you input a list of swcs"<<endl;
return false;
}
}
}
QString outfileName;
if (outlist->size()==0)
outfileName = qs_linker + "_vote_map.v3draw";
else
outfileName = QString(outlist->at(0));
int dilation_radius = 0;
if (!vote_map(nt_list,dilation_radius,outfileName, callback))
{
cerr<<"error in consensus_skeleton"<<endl;
return false;
}
return true;
}
bool consensus_swc_func(const V3DPluginArgList & input, V3DPluginArgList & output, V3DPluginCallback2 &callback)
{
if(input.size()==0 || output.size() != 1) return false;
char * paras = NULL;
//parsing input
vector<char *> * inlist = (vector<char*> *)(input.at(0).p);
if (inlist->size()==0)
{
cerr<<"You must specify input linker or swc files"<<endl;
return false;
}
//parsing output
vector<char *> * outlist = (vector<char*> *)(output.at(0).p);
if (outlist->size()>1)
{
cerr << "You cannot specify more than 1 output files"<<endl;
return false;
}
//parsing parameters
int max_vote_threshold = 3; //>= max_vote_threshold votes, definitely included as part of the final consensus
double cluster_distance_threshold = 5; // ignore nodes that far away for clustering
int resample_flag = 0;//no longer used
int REMOVE_OUTLIER = 1;
if (input.size()==2)
{
vector<char*> * paras = (vector<char*> *)(input.at(1).p);
if (paras->size() >= 1)
{
max_vote_threshold = atoi(paras->at(0));
cout<<"max_vote_threshold = "<<max_vote_threshold<<endl;
if (paras->size() >= 2){
cluster_distance_threshold = atoi(paras->at(1));
cout<<"clustering distance threshold = "<<cluster_distance_threshold<<endl;
}
if (paras->size() >= 3){
REMOVE_OUTLIER = atoi(paras->at(2));
cout<<"remove_outliers = "<<REMOVE_OUTLIER<<endl;
}
}
else
{
cerr<<"Too many parameters"<<endl;
return false;
}
}
vector<NeuronTree> nt_list;
QStringList nameList;
QString qs_linker;
char * dfile_result = NULL;
V3DLONG neuronNum = 0;
for (int i=0;i<inlist->size();i++)
{
qs_linker = QString(inlist->at(i));
if (qs_linker.toUpper().endsWith(".ANO"))
{
cout<<"(0). reading a linker file."<<endl;
P_ObjectFileType linker_object;
if (!loadAnoFile(qs_linker,linker_object))
{
fprintf(stderr,"Error in reading the linker file.\n");
return 1;
}
nameList = linker_object.swc_file_list;
neuronNum += nameList.size();
for (V3DLONG i=0;i<neuronNum;i++)
{
NeuronTree tmp = readSWC_file(nameList.at(i));
nt_list.push_back(tmp);
}
}
else if (qs_linker.toUpper().endsWith(".SWC"))
{
//cout<<"(0). reading an swc file"<<endl;
NeuronTree tmp = readSWC_file(qs_linker);
nt_list.push_back(tmp);
neuronNum++;
if (outlist->size()==0)
{
cerr<<"You must specify outfile name if you input a list of swcs"<<endl;
return false;
}
}
}
QString outfileName;
if (outlist->size()==0)
outfileName = qs_linker + "_consensus.swc";
else
outfileName = QString(outlist->at(0));
QList<NeuronSWC> merge_result;
QString SelectedNeuronsAnoFileName = outfileName+"_SelectedNeurons.ano";
double bridge_gap = 1.0;
sort_all_inputs(nt_list, bridge_gap);
prune_all_inputs(nt_list, cluster_distance_threshold);
if (REMOVE_OUTLIER >0){
if( ! remove_outliers(nt_list, SelectedNeuronsAnoFileName))
{
cout<<"Error: failed at remove outlier step." <<endl;
return false;
}
}
if (!consensus_skeleton_match_center(nt_list, merge_result, max_vote_threshold,cluster_distance_threshold, resample_flag, callback))
{
cerr<<"error in consensus_skeleton"<<endl;
return false;
}
export_listNeuron_2swc(merge_result,qPrintable(outfileName));
printf("%s has been generated successfully\n",qPrintable(outfileName));
return true;
}
bool post_consensus_trimming(const V3DPluginArgList & input, V3DPluginArgList & output)
{
if(input.size()==0) return false;
char * paras = NULL;
//parsing input
vector<char *> * inlist = (vector<char*> *)(input.at(0).p);
if (inlist->size()==0)
{
cerr<<"You must specify input linker or swc files"<<endl;
return false;
}
QString qs_linker;
NeuronTree nt;
qs_linker = QString(inlist->at(0));
if (qs_linker.toUpper().endsWith(".SWC") || qs_linker.toUpper().endsWith(".ESWC"))
{
//cout<<"(0). reading an swc file"<<endl;
nt = readSWC_file(qs_linker);
}
else
{
return false;
}
QString outfileName;
if (output.size()==0)
outfileName = qs_linker + "_trim.swc";
else
{
vector<char *> * outlist = (vector<char*> *)(output.at(0).p);
outfileName = QString(outlist->at(0));
}
//parsing parameters
//int steps = 5;
double threshold = 0.3;
if (input.size()==2)
{
vector<char*> * paras = (vector<char*> *)(input.at(1).p);
if (paras->size() >= 1)
{
threshold = atof(paras->at(0));
cout<<"threshold = "<<threshold<<endl;
}
else
{
cerr<<"Too many parameters"<<endl;
return false;
}
}
generate_batch_trimmed_results(nt,outfileName,threshold,1);
return true;
}
bool dark_pruning_func(const V3DPluginArgList & input, V3DPluginArgList & output, V3DPluginCallback2 &callback)
{
if(input.size() <2 )
{
cerr<<"You must specify input eswc file and the corresponding image file."<<endl;
return false;
}
//parsing input
vector<char *> * inlist = (vector<char*> *)(input.at(0).p);
if (inlist->size()<2)
{
cerr<<"You must specify input eswc file and the corresponding image file."<<endl;
return false;
}
//parsing output
vector<char *> * outlist = (vector<char*> *)(output.at(0).p);
if (outlist->size() > 1)
{
cerr << "You can only specify one output file"<<endl;
return false;
}
//parsing parameters
int visible_thre =0;
vector<char*> * paras = (vector<char*> *)(input.at(1).p);
if (paras->size() == 1)
{
visible_thre = atoi(paras->at(0));
cout<<"The visible threshold for dark pruning is: "<<visible_thre<<endl;
}
else
{
cerr<<"One ( and only one) parameter is required."<<endl;
return false;
}
QString input_swc_fn = QString(inlist->at(0));
NeuronTree input_nt = readSWC_file(input_swc_fn);
Image4DSimple * p4dImage = callback.loadImage( inlist->at(1) );
if (!p4dImage || !p4dImage->valid())
return false;
QString outfileName;
if (outlist->size()==0)
outfileName = input_swc_fn + "_dark_pruned.swc";
else
outfileName = QString(outlist->at(0));
QList<NeuronSWC> result_swc;
if (!dark_pruning (input_nt, result_swc,p4dImage,visible_thre))
{
cerr<<"Error in dark pruning."<<endl;
return false;
}
export_listNeuron_2swc(result_swc,qPrintable(outfileName));
printf("%s has been generated successfully\n",qPrintable(outfileName));
return true;
}
bool median_swc_func(const V3DPluginArgList & input, V3DPluginArgList & output)
{
if(input.size()==0) return false;
//parsing input
vector<char *> * inlist = (vector<char*> *)(input.at(0).p);
if (inlist->size() == 0)
{
cerr<<"You must specify input linker or swc files"<<endl;
return false;
}
//parsing output
vector<char *> * outlist = (vector<char*> *)(output.at(0).p);
if (outlist->size()>1)
{
cerr<<"You cannot specify more than 1 output files"<<endl;
return false;
}
V3DLONG neuronNum = 0;
vector<NeuronTree> nt_list;
QString qs_linker;
QStringList nameList;
for (int i=0;i<inlist->size();i++)
{
qs_linker = QString(inlist->at(i));
if (qs_linker.toUpper().endsWith(".ANO"))
{
cout<<"(0). reading a linker file."<<endl;
P_ObjectFileType linker_object;
if (!loadAnoFile(qs_linker,linker_object))
{
fprintf(stderr,"Error in reading the linker file.\n");
return 1;
}
nameList = linker_object.swc_file_list;
neuronNum += nameList.size();
for (V3DLONG i=0;i<neuronNum;i++)
{
NeuronTree tmp = readSWC_file(nameList.at(i));
nt_list.push_back(tmp);
}
}
else if (qs_linker.toUpper().endsWith(".SWC") || qs_linker.toUpper().endsWith(".ESWC"))
{
//cout<<"(0). reading an swc file"<<endl;
NeuronTree tmp = readSWC_file(qs_linker);
nt_list.push_back(tmp);
neuronNum++;
}
}
QString outfileName;
if (outlist->size()==0)
outfileName = qs_linker+ "_sum_dist.csv";
else
outfileName = QString(outlist->at(0));
cout << "There are "<<nt_list.size() <<" input neurons."<<endl;
int idx = median_swc(nt_list,outfileName);
if (idx <0){
cerr << "error in median_swc()" << endl;
return false;
}
QString fn = nt_list[idx].file;
cout<<"Median swc is neuron " << idx <<" :" <<fn.toStdString().c_str()<< endl;
return true;
}
bool average_node_position_func(const V3DPluginArgList & input, V3DPluginArgList & output)
{
//parsing input
vector<char *> * inlist = (vector<char*> *)(input.at(0).p);
cout<<"\n\n inlist.size = "<<inlist->size()<<endl;
if ( inlist->size() <2 )
{
cerr<<"You must specify inputs: median swc file and the linker file"<<endl;
return false;
}
//parsing output
vector<char *> * outlist = (vector<char*> *)(output.at(0).p);
if (outlist->size()>1)
{
cerr<<"You cannot specify more than 1 output files"<<endl;
return false;
}
//parsing parameters
V3DLONG distance_threshold= 0;
V3DLONG soma_radius = 0;
vector<char*> * paras = (vector<char*> *)(input.at(1).p);
if (paras->size() >= 1)
{
distance_threshold = atoi(paras->at(0));
cout<<"distance_threshold = "<<distance_threshold<<endl;
}
if (paras->size() >= 2)
{
soma_radius = atoi(paras->at(1));
cout << "soma_radius = " << soma_radius << endl;
}
if (paras->size() > 2)
{
cerr<<"Too many parameters"<<endl;
return false;
}
vector<NeuronTree> nt_list;
QStringList nameList;
QString qs_linker;
char * dfile_result = NULL;
V3DLONG neuronNum = 0;
NeuronTree median_neuron;
qs_linker = QString(inlist->at(0));
if (qs_linker.toUpper().endsWith(".SWC"))
{
//cout<<"(0). reading an swc file"<<endl;
median_neuron= readSWC_file(qs_linker);
}
else{
cout <<" The first input should be an swc file ( median neuron)." <<endl;
return false;
}
QString outfileName;
if (outlist->size()==0)
outfileName = qs_linker + "_median_adjusted.swc";
else
outfileName = QString(outlist->at(0));
if (median_neuron.listNeuron.size() == 0)
{
cout << "input neuron null, saving null swc" << endl;
writeSWC_file(outfileName, median_neuron);
return true;
}
qs_linker = QString(inlist->at(1));
if (qs_linker.toUpper().endsWith(".ANO"))
{
cout<<"(0). reading a linker file."<<endl;
P_ObjectFileType linker_object;
if (!loadAnoFile(qs_linker,linker_object))
{
fprintf(stderr,"Error in reading the linker file.\n");
return 1;
}
nameList = linker_object.swc_file_list;
neuronNum += nameList.size();
for (V3DLONG i=0;i<neuronNum;i++)
{
NeuronTree tmp = readSWC_file(nameList.at(i));
nt_list.push_back(tmp);
}
}
else
{
cout <<" The second input should be a ANO file ( the group of neurons)." <<endl;
}
NeuronTree median_adjusted = average_node_position(median_neuron, nt_list, distance_threshold, soma_radius);
if (median_adjusted.listNeuron.size() == 0 ){
cerr<<"error in average_node_position()"<<endl;
return false;
}
writeSWC_file(outfileName, median_adjusted);
printf("\t %s has been generated successfully\n",qPrintable(outfileName));
return true;
}
int average_node_position_menu(V3DPluginCallback2 &callback, QWidget *parent)
{
QString fileOpenName1;
fileOpenName1 = QFileDialog::getOpenFileName(0, QObject::tr("Open the median SWC File"),
"",
QObject::tr("Supported file (*.swc)"
));
if(fileOpenName1.isEmpty())
return -1;
NeuronTree median_neuron = readSWC_file(fileOpenName1);
QString fileOpenName2 = QFileDialog::getOpenFileName(0, QObject::tr("Open the ano File that contains all input SWCs"),
"",
QObject::tr("Supported file (*.ano)"
";;Neuron structure (*.ano)"
));
if(fileOpenName2.isEmpty())
return -1;
P_ObjectFileType linker_object;
if (!loadAnoFile(fileOpenName2,linker_object))
{
fprintf(stderr,"Error in reading the linker file.\n");
return -1;
}
QStringList nameList = linker_object.swc_file_list;
V3DLONG neuronNum = nameList.size();
V3DLONG avg_node_num = 0;
V3DLONG max_node_num = -1;
vector<NeuronTree> nt_list;
for (V3DLONG i=0;i<neuronNum;i++)
{
NeuronTree tmp = readSWC_file(nameList.at(i));
nt_list.push_back(tmp);
avg_node_num += tmp.listNeuron.size();
if (tmp.listNeuron.size() > max_node_num)
max_node_num = tmp.listNeuron.size();
}
avg_node_num /= neuronNum;
bool ok;
double distance_threshold= QInputDialog::getDouble(parent, "distance threshold",
"Please specify the maximum distance allowed to search for maching nodes in all input neurons: ",8, 1, 100, 1, &ok );
if (!ok)
return 0;
NeuronTree median_adjusted = average_node_position(median_neuron, nt_list, distance_threshold);
QString fileSaveName;
QString defaultSaveName = fileOpenName1 + "_adjusted.swc";
fileSaveName = QFileDialog::getSaveFileName(0, QObject::tr("Save adjusted median neuron to file:"),
defaultSaveName,
QObject::tr("Supported file (*.swc)"
";;Neuron structure (*.swc)"
));
if (!writeSWC_file(qPrintable(fileSaveName),median_adjusted))
{
v3d_msg("Unable to save file");
return -1;
}
return 1;
}
int median_swc_menu(V3DPluginCallback2 &callback, QWidget *parent)
{
v3d_msg("Not implemented yet. Please use the command line option.");
return 0;
}
void printHelp()
{
cout<<"\nConsensus Skeleton: This plugin has the following five functions:"<<endl;
cout<<"\n 1) Generate a consensus neuron skeleton (eswc file) from a group of neurons ( radii are ignored)."<<endl;
cout<<"\nUsage: v3d -x consensus_swc -f consensus_swc -i <*.swc or ano file> -o <output_file> -p <max vote threshold> < clustering distance threshold> <remove outliers>"<<endl;
cout<<"Parameters:"<<endl;
cout<<"\t-f <function_name>: consensus_swc"<<endl;
cout<<"\t-i <input>: input linker file (.ano) or swc files"<<endl;
cout<<"\t-p <max_vote_threshold> <clustering_distance_threshold> <remove_outliers>: a) max_vote_threshold: by default votes bigger than 1/3 of valid inputs will be "<<endl;
cout<<"\t included for consensing, this max_vote_threshold is setting the upper bound such voting threshold." <<endl;
cout<<"\t b) clustering distance threshold: the maximum voxel distance that are allowed to cluster one swc node to the " <<endl;
cout<<"\t consensused node location during the edge voting step. c)remove_outeliers: for preprocessing:1--remove outliers based on total length and birfircations, 0-- Keep all entries.Default=1." <<endl;
cout<<"\t-o <output_file>: output consensus eswc file name. The ESWC contains the edge connection confidence/voting value at each swc node."<<endl;
cout<<"Example: v3d -x consensus_swc -f consensus_swc -i mylinker.ano -o consensus.eswc -p 3 5 1\n"<<endl;
cout<<"Example: v3d -x consensus_swc -f consensus_swc -i myfolder/*.swc -o consensus.eswc -p 3 5 0\n"<<endl;
cout<<"\n 2) Pick the median neuron tree from a group of input neuron tress."<<endl;
cout<<"\nUsage: v3d -x consensus_swc -f median_swc -i <input ANO linker file> [-o <output csv file>] "<<endl;
cout<<"Parameters:"<<endl;
cout<<"\t-f <function_name>: median_swc"<<endl;
cout<<"\t-i <input_file(s)>: an input linker file (.ano) or multiple swc files"<<endl;
cout<<"\t-o <output_csv_file>: print out the pair-wise distances for each input neuron to all other neurons."<<endl;
cout<< " The index number of the median swc in the ano file will be reported in standard output. "<<endl;
cout<<"Example: v3d -x consensus_swc -f median_swc -i mylinker.ano[myfolder/*.swc] -o distances.csv \n"<<endl;
cout<<"\n 3) Adjust input neuron node locations by averaging over the matching nodes from the input group of neurons tree."<<endl;
cout<<"\nUsage: v3d -x consensus_swc -f average_node_position -i <median swc> <linker ANO file> -o <output_file> -p <distance_threshold>"<<endl;
cout<<"Parameters:"<<endl;
cout<<"\t-f <function_name>: average_node_position"<<endl;
cout<<"\t-i <median swc>: input median swc file (generated from median_swc function)"<<endl;
cout<<"\t <linker ANO file>: input linker file (.ano)"<<endl;
cout<<"\t -p <distance_threshold>: nodes that have distances larger than this threshold will "
"not be considered matching for averaging." <<endl;
cout<<"\t -o <output_file>: output file name." <<endl;
cout<<"Example: v3d -x consensus_swc -f average_node_position -i median.swc mylinker.ano -p 8 -o median_adjusted.swc\n"<<endl;
cout<<"\n 4) Generate a vote map volume (aggregated mask images) from multiple neurons (radii are considered)."<<endl;
cout<<"\nUsage: v3d -x consensus_swc -f vote_map -i <input> -o <output_image_file> "<<endl;
cout<<"Parameters:"<<endl;
cout<<"\t-f <function_name>: vote_map"<<endl;
cout<<"\t-i <input>: input linker file (.ano) or folder path"<<endl;
cout<<"\t-o <output_image_file>: output image file name."<<endl;
cout<<"Example: v3d -x consensus_swc -f vote_map -i mylinker.ano -o vote_map.v3draw\n"<<endl;
cout<<"\n 5) Prune consensus based on original image" <<endl;
cout<<"\nUsage: v3d -x consensus_swc -f dark_pruning -i <input_consensus_file> <input_image_file> -o <output_swc_file> "<<endl;
cout<<"Parameters:"<<endl;
cout<<"\t-f <function_name>: dark_pruning"<<endl;
cout<<"\t-i <input_eswc> <input_image>: input_consensus_eswc input_image"<<endl;
cout<<"\t-o <output_image_file>: output image file name."<<endl;
cout<<"\t-p <visible_threshold>: visible threshold for dark pruning."<<endl;
cout<<"Example: v3d -x consensus_swc -f dark_pruning -i input_consensus_file input_image.v3dpbd -o pruned.swc -p 40\n"<<endl;
cout<<"\n 6) Post-processing: trim the less significant nodes in a given tree, with specified threshold" <<endl;
cout<<"\nUsage: v3d -x consensus_swc -f post_trimming -i <input_neuron_file> [-o <output_swc_file>] -p threshold"<<endl;
cout<<"Parameters:"<<endl;
cout<<"\t-f <function_name>: post_trimming"<<endl;
cout<<"\t-i <input_neuron_file>: input_neuron_file, swc or eswc"<<endl;
cout<<"\t-o <output_swc_file>: output file name."<<endl;
cout<<"\t-p <threshold>: threshold for trimming."<<endl;
cout<<"Example: v3d /x consensus_swc /f post_trimming /i consensus_untrim.eswc /o consensus_trimmed /p 0.5\n"<<endl;
}