virtual void init(Voxel& voxel) { if (!voxel.odf_deconvolusion) return; voxel.recon_report << "Diffusion ODF deconvolution (Yeh et al., Neuroimage, 2011) was conducted using a regularization parameter of " << voxel.param[2]; std::for_each(voxel.response_function.begin(),voxel.response_function.end(), boost::lambda::_1 /= (std::accumulate(voxel.response_function.begin(),voxel.response_function.end(),0.0) /((double)voxel.response_function.size()))); // scale the free water diffusion to 1 std::for_each(voxel.free_water_diffusion.begin(),voxel.free_water_diffusion.end(),(boost::lambda::_1 /= voxel.reponse_function_scaling)); half_odf_size = voxel.ti.half_vertices_count; estimate_Rt(voxel); A.resize(half_odf_size*half_odf_size); pv.resize(half_odf_size); image::matrix::product_transpose(Rt.begin(),Rt.begin(),A.begin(), image::dyndim(half_odf_size,half_odf_size),image::dyndim(half_odf_size,half_odf_size)); AA = A; for (unsigned int i = 0,index = 0; i < half_odf_size; ++i,index += half_odf_size + 1) A[index] += voxel.param[2]; image::matrix::lu_decomposition(A.begin(),pv.begin(),image::dyndim(half_odf_size,half_odf_size)); get_error_percentage(voxel); }
virtual void init(Voxel& voxel) { if (!voxel.odf_decomposition) return; decomposition_fraction = voxel.param[3]; m = std::max<int>(voxel.param[4],voxel.max_fiber_number); fiber_ratio.resize(voxel.dim.size()); max_iso = 0.0; half_odf_size = voxel.ti.half_vertices_count; is_neighbor.resize(half_odf_size); for(unsigned int index = 0;index < half_odf_size;++index) is_neighbor[index].resize(half_odf_size); for(unsigned int index = 0;index < voxel.ti.faces.size();++index) { short i1 = voxel.ti.faces[index][0]; short i2 = voxel.ti.faces[index][1]; short i3 = voxel.ti.faces[index][2]; if (i1 >= half_odf_size) i1 -= half_odf_size; if (i2 >= half_odf_size) i2 -= half_odf_size; if (i3 >= half_odf_size) i3 -= half_odf_size; is_neighbor[i1][i2] = 1; is_neighbor[i2][i1] = 1; is_neighbor[i1][i3] = 1; is_neighbor[i3][i1] = 1; is_neighbor[i2][i3] = 1; is_neighbor[i3][i2] = 1; } // scale the free water diffusion to 1 std::for_each(voxel.free_water_diffusion.begin(),voxel.free_water_diffusion.end(),(boost::lambda::_1 /= voxel.reponse_function_scaling)); estimate_Rt(voxel); }