From 9a7cfbe7801426edd7f8a58d6de3bb5f60b5cbc9 Mon Sep 17 00:00:00 2001 From: Saad Jbabdi <saad@fmrib.ox.ac.uk> Date: Mon, 30 Nov 2009 17:31:38 +0000 Subject: [PATCH] random sampling withina voxel --- streamlines.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/streamlines.cc b/streamlines.cc index cd1b1fd..c892bd8 100644 --- a/streamlines.cc +++ b/streamlines.cc @@ -1116,6 +1116,17 @@ void Counter::save_matrix3(){ fibst = (int)round(tmp); } + // random sampling within a seed voxel + float newx=x,newy=y,newz=z; + if(opts.sampvox.value()){ + float tmp2=rand()/float(RAND_MAX)-0.5; + newx+=tmp2; + tmp2=rand()/float(RAND_MAX)-0.5; + newy+=tmp2; + tmp2=rand()/float(RAND_MAX)-0.5; + newz+=tmp2; + } + if(opts.verbose.value()>1) logger.setLogFile("particle"+num2str(p)); @@ -1123,7 +1134,7 @@ void Counter::save_matrix3(){ bool forwardflag=false,backwardflag=false; bool counted=false; if(!onewayonly || opts.matrix3out.value()){//always go both ways in matrix3 mode - if(m_stline.streamline(x,y,z,m_seeddims,fibst,rotdir)){ //returns whether to count the streamline or not + if(m_stline.streamline(newx,newy,newz,m_seeddims,fibst,rotdir)){ //returns whether to count the streamline or not forwardflag=true; m_counter.store_path(); m_counter.count_streamline(); @@ -1132,7 +1143,7 @@ void Counter::save_matrix3(){ m_stline.reverse(); } - if(m_stline.streamline(x,y,z,m_seeddims,fibst,rotdir)){ + if(m_stline.streamline(newx,newy,newz,m_seeddims,fibst,rotdir)){ backwardflag=true; m_counter.count_streamline(); -- GitLab