コード例 #1
0
 virtual void end(Voxel& voxel,gz_mat_write& mat_writer)
 {
     voxel.recon_report
             << " The percentage of the negative signals was " << (float)100.0*total_negative_value/(float)total_value << "%.";
     std::vector<float> b_table(4); // space for b0
     for (unsigned int index = 0;index < bvectors.size();++index)
     {
         b_table.push_back(bvalues.front());
         std::copy(bvectors[index].begin(),bvectors[index].end(),std::back_inserter(b_table));
     }
     mat_writer.write("b_table",&b_table[0],4,b_table.size()/4);
     unsigned int image_num = 0;
     if(!b0.empty())
     {
         mat_writer.write("image0",&b0[0],1,b0.size());
         ++image_num;
     }
     for (unsigned int index = 0;index < dwi.size();++index)
     {
         std::ostringstream out;
         out << "image" << image_num;
         mat_writer.write(out.str().c_str(),&(dwi[index][0]),1,dwi[index].size());
         ++image_num;
     }
 }
コード例 #2
0
ファイル: dti_process.hpp プロジェクト: YounesN/DSI-Studio
 virtual void end(Voxel& voxel,gz_mat_write& mat_writer)
 {
     mat_writer.write("fa0",&*voxel.fib_fa.begin(),1,voxel.fib_fa.size());
     mat_writer.write("dir0",&*voxel.fib_dir.begin(),1,voxel.fib_dir.size());
     mat_writer.write("adc",&*md.begin(),1,md.size());
     mat_writer.write("axial_dif",&*d0.begin(),1,d0.size());
     mat_writer.write("radial_dif",&*d1.begin(),1,d1.size());
 }
コード例 #3
0
 virtual void end(Voxel& voxel,gz_mat_write& mat_writer)
 {
     if (!voxel.odf_deconvolusion)
         return;
     mat_writer.write("deconvolution_kernel",&*voxel.response_function.begin(),1,voxel.response_function.size());
     mat_writer.write("free_water_diffusion",&*voxel.free_water_diffusion.begin(),1,voxel.free_water_diffusion.size());
     mat_writer.write("sensitivity_error_percentage",&sensitivity_error_percentage,1,1);
     mat_writer.write("specificity_error_percentage",&specificity_error_percentage,1,1);
 }
コード例 #4
0
ファイル: odf_process.hpp プロジェクト: sw82arup/DSI-Studio
 virtual void end(Voxel& voxel,gz_mat_write& mat_writer)
 {
     if (voxel.need_odf)
     {
         set_title("output odfs");
         for (unsigned int index = 0;index < voxel.template_odfs.size();++index)
         {
             std::ostringstream out;
             out << "odf" << index;
             mat_writer.write(out.str().c_str(),&*voxel.template_odfs[index].begin(),
                                   voxel.ti.half_vertices_count,
                                   voxel.template_odfs[index].size()/(voxel.ti.half_vertices_count));
         }
     }
     mat_writer.write("trans",&*voxel.param,4,4);
 }
コード例 #5
0
ファイル: odf_process.hpp プロジェクト: sw82arup/DSI-Studio
    virtual void end(Voxel& voxel,gz_mat_write& mat_writer)
    {
        set_title("output data");
        mat_writer.write("gfa",&*gfa.begin(),1,gfa.size());

        if(!voxel.odf_deconvolusion && voxel.z0 + 1.0 != 1.0)
        {
            mat_writer.write("z0",&voxel.z0,1,1);
            std::for_each(iso.begin(),iso.end(),boost::lambda::_1 /= voxel.z0);
            for (unsigned int i = 0;i < voxel.max_fiber_number;++i)
                std::for_each(fa[i].begin(),fa[i].end(),boost::lambda::_1 /= voxel.z0);
        }

        mat_writer.write("iso",&*iso.begin(),1,iso.size());

        for (unsigned int index = 0;index < voxel.max_fiber_number;++index)
        {
            std::ostringstream out;
            out << index;
            std::string num = out.str();
            std::string fa_str = "fa";
            fa_str += num;
            set_title(fa_str.c_str());
            mat_writer.write(fa_str.c_str(),&*fa[index].begin(),1,fa[index].size());
        }

        // output normalized qa
        {
            float max_qa = 0.0;
            for (unsigned int i = 0;i < voxel.max_fiber_number;++i)
                max_qa = std::max<float>(*std::max_element(fa[i].begin(),fa[i].end()),max_qa);

            if(max_qa != 0.0)
            for (unsigned int index = 0;index < voxel.max_fiber_number;++index)
            {
                std::for_each(fa[index].begin(),fa[index].end(),boost::lambda::_1 /= max_qa);
                std::ostringstream out;
                out << index;
                std::string num = out.str();
                std::string fa_str = "nqa";
                fa_str += num;
                set_title(fa_str.c_str());
                mat_writer.write(fa_str.c_str(),&*fa[index].begin(),1,fa[index].size());
            }
        }
    }
コード例 #6
0
    virtual void end(Voxel& voxel,gz_mat_write& mat_writer)
    {
        if (!voxel.odf_decomposition)
            return;
        if(max_iso + 1.0 != 1.0)
            std::for_each(fiber_ratio.begin(),fiber_ratio.end(),boost::lambda::_1 /= max_iso);
        mat_writer.write("fiber_ratio",&*fiber_ratio.begin(),1,fiber_ratio.size());

    }
コード例 #7
0
    virtual void end(Voxel& voxel,gz_mat_write& mat_writer)
    {
        for(unsigned int index = 0;index < max_length;++index)
        {
            std::ostringstream out;
            out << "pdf_" << index << "um";
            mat_writer.write(out.str().c_str(),&*dis[index].begin(),1,dis[index].size());

        }
        for(unsigned int index = 0;index < max_length;++index)
        {
            std::ostringstream out;
            out << "cdf_" << index << "um";
            mat_writer.write(out.str().c_str(),&*cdf[index].begin(),1,cdf[index].size());
        }
        mat_writer.write("fa0",&*dis[0].begin(),1,dis[0].size());
        std::vector<short> index0(voxel.dim.size());
        mat_writer.write("index0",&*index0.begin(),1,index0.size());
    }
コード例 #8
0
ファイル: odf_process.hpp プロジェクト: sw82arup/DSI-Studio
 virtual void end(Voxel& voxel,gz_mat_write& mat_writer)
 {
     for (unsigned int index = 0;index < voxel.max_fiber_number;++index)
     {
         std::ostringstream out;
         out << index;
         std::string num = out.str();
         std::string index_str = "dir";
         index_str += num;
         set_title(index_str.c_str());
         mat_writer.write(index_str.c_str(),&*dir[index].begin(),1,dir[index].size());
     }
 }
コード例 #9
0
ファイル: image_model.hpp プロジェクト: YounesN/DSI-Studio
    void save_to_file(gz_mat_write& mat_writer)
    {

        set_title("saving");

        // dimension
        {
            short dim[3];
            dim[0] = voxel.dim[0];
            dim[1] = voxel.dim[1];
            dim[2] = voxel.dim[2];
            mat_writer.write("dimension",dim,1,3);
        }

        // voxel size
        mat_writer.write("voxel_size",&*voxel.vs.begin(),1,3);

        std::vector<float> float_data;
        std::vector<short> short_data;
        voxel.ti.save_to_buffer(float_data,short_data);
        mat_writer.write("odf_vertices",&*float_data.begin(),3,voxel.ti.vertices_count);
        mat_writer.write("odf_faces",&*short_data.begin(),3,voxel.ti.faces.size());

    }
コード例 #10
0
ファイル: odf_process.hpp プロジェクト: sw82arup/DSI-Studio
    virtual void end(Voxel& voxel,gz_mat_write& mat_writer)
    {

        if (!voxel.need_odf)
            return;
        {
            set_title("output odfs");
            for (unsigned int index = 0;index < odf_data.size();++index)
            {
                if (!voxel.odf_deconvolusion)
                    std::for_each(odf_data[index].begin(),odf_data[index].end(),boost::lambda::_1 /= voxel.z0);
                std::ostringstream out;
                out << "odf" << index;
                mat_writer.write(out.str().c_str(),&*odf_data[index].begin(),
                                      voxel.ti.half_vertices_count,
                                      odf_data[index].size()/(voxel.ti.half_vertices_count));
            }
            odf_data.clear();
        }

    }
コード例 #11
0
 virtual void end(Voxel&,gz_mat_write& mat_writer)
 {
     if(hgqi)
         mat_writer.write("hraw",&hraw[0],1,hraw.size());
 }