Beispiel #1
0
int Preprocessor::resize(){
    string src = para.res_src;
    string dst = para.res_dst;
    string in_pre = para.res_in_pre;
    string in_post = para.res_in_post;
    string out_pre = para.res_out_pre;
    string out_post = para.res_out_post;
    unsigned int serial_beg = para.serial_beg;
    unsigned int serial_end = para.serial_end, serial_bits = para.serial_bits, thread_num = para.thread_num;
    double res_fx = para.res_fx;
    double res_fy = para.res_fy;
    string sys_del = para.sys_del;
#pragma omp parallel for num_threads(thread_num) 
    for(int serial_num = serial_beg; serial_num <= int(serial_end); ++ serial_num){
        string serial_str(""), in_path(""), out_path("");
        stringstream str_buffer;
        cv::Mat in_image, out_image;
        str_buffer<<setw(serial_bits)<<setfill('0')<<serial_num;
        str_buffer>>serial_str;
        str_buffer.clear();
        cout<<serial_str<<endl;
        in_path = src + sys_del + in_pre + serial_str + in_post;
        //cout<<in_path<<endl;
        out_path = dst + sys_del + out_pre + serial_str + out_post;
        //cout<<in_path<<endl;
        in_image = cv::imread(in_path, CV_LOAD_IMAGE_UNCHANGED);
        cv::resize(in_image, out_image, cv::Size(), res_fx, res_fy, cv::INTER_LINEAR);
        cv::imwrite(out_path, out_image);
    }
    return 0;
}
Beispiel #2
0
shared_ptr<temp_dir> testcase::_prepare_dir(judge::pool &pool, const compiler::result &cr)
{
	shared_ptr<temp_dir> dir = pool.create_temp_dir("test_");
	path_a in_path(cr.dir->path());
	in_path.push(cr.compiler->target_filename().c_str());
	path_a out_path(dir->path());
	out_path.push(cr.compiler->target_filename().c_str());
	file_copy(in_path, out_path);
	return dir;
}
void global_settings_io::export_settings(const std::string& output_dir)
{
  if(!settings_file_name_.empty())
  {
    namespace fs = boost::filesystem;
    std::string config_dir = output_dir + "/config";
    fs::path out_path(config_dir);
    fs::create_directory(out_path);
    utils::copy_file(settings_file_name_, config_dir);
  }
}
int main(int argc, char** argv) 
{
    std::string seg_path("data/ln_joint/");
    std::string gt_path("final_joint_gt/");
    std::string out_path("");
    
    //pcl::visualization::PCLVisualizer::Ptr viewer(new pcl::visualization::PCLVisualizer());
    //viewer->initCameraParameters();
    //viewer->addCoordinateSystem(0.1);
    //viewer->setCameraPosition(0, 0, 0.1, 0, 0, 1, 0, -1, 0);
    
    int c1 = 0, c2 = -1;
    pcl::console::parse_argument(argc, argv, "--gt", gt_path);
    pcl::console::parse_argument(argc, argv, "--eg", seg_path);
    pcl::console::parse_argument(argc, argv, "--o", out_path);
    
    pcl::console::parse_argument(argc, argv, "--c1", c1);
    pcl::console::parse_argument(argc, argv, "--c2", c2);
    
    if( out_path.empty() == false && exists_dir(out_path) == false )
        boost::filesystem::create_directories(out_path);
    
    float acc = 0;
    int acc_count = 0;
    for(int i = c1 ; i <= c2 ; i++ )
    {
        std::stringstream ss;
        ss << i;
        
        std::string pcd_file(seg_path + "seg_" + ss.str() + ".pcd");
        std::string link_pose_file(gt_path + "link_gt_" + ss.str() + ".csv");
        std::string node_pose_file(gt_path + "node_gt_" + ss.str() + ".csv");
        std::cerr << "Loading... " << pcd_file << std::endl;
        
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        pcl::PointCloud<PointT>::Ptr cloud(new pcl::PointCloud<PointT>());
        pcl::io::loadPCDFile(pcd_file, *cloud);
        if( cloud->empty() == true )
            break;
        acc_count++;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        std::vector<poseT> all_poses;
        readCSV(link_pose_file, "link", all_poses);
        readCSV(node_pose_file, "node", all_poses);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //read meshes
        ModelT link_mesh = LoadMesh(link_mesh_name, "link");
        ModelT node_mesh = LoadMesh(node_mesh_name, "node"); 
        
        std::vector<ModelT> mesh_set;
        mesh_set.push_back(link_mesh);
        mesh_set.push_back(node_mesh);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        
        //viewer->removePointCloud("cloud");
        //viewer->addPointCloud(cloud, "cloud");
        //viewer->spin();
        
        float cur_acc = segAcc(mesh_set, all_poses, cloud);
        std::cerr << "P: " << cur_acc << std::endl;
        acc += cur_acc;
        
        if( out_path.empty() == false )
            pcl::io::savePCDFile(out_path + "seg_" + ss.str() + ".pcd", *cloud, true);
        
        //viewer->removePointCloud("cloud");
        //viewer->addPointCloud(cloud, "cloud");
        //viewer->spin();
        /*
        cv::Mat gt_label, seg_label, uv;
        int gt_num = MeshOn2D(mesh_set, all_poses, gt_label);
        int seg_num = segProj(cloud, seg_label, uv);
        int true_pos = overlapGT(gt_label, seg_label, uv);
        
        std::cerr << "P: " << (true_pos+0.0) / seg_num << std::endl;
        acc += (true_pos+0.0) / seg_num;
        //*
        showLabel(gt_label, "GT");
        showLabel(seg_label, "Seg");
        //*/
    }
    std::cerr << "Seg-Acc: " << acc / acc_count << std::endl;
    
/*************************************************************************************************************************/

    return 0;
}
int main(int argc, char** argv)
{
    std::string path("/home/chi/arco/test/build/temp/");
    std::string filename("temp_0_0");
    pcl::console::parse_argument(argc, argv, "--f", filename);
    pcl::PointCloud<PointT>::Ptr cloud(new pcl::PointCloud<PointT>());
    pcl::io::loadPCDFile(path+filename+".pcd", *cloud);
    
    int w = cloud->width;
    int h = cloud->height;
    cv::Mat img = cv::Mat::zeros(h, w, CV_8UC3);
    for( size_t i = 0 ; i < cloud->size() ; i++ )
    {
        int r = i / w;
        int c = i % w;
        
        uint32_t rgb_tmp = cloud->at(i).rgba;
        
        img.at<uchar>(r, c*3+2) = (rgb_tmp >> 16) & 0x0000ff;
        img.at<uchar>(r, c*3+1) = (rgb_tmp >> 8) & 0x0000ff;
        img.at<uchar>(r, c*3+0) = (rgb_tmp) & 0x0000ff;
    }
    
    cv::imwrite(filename+".png", img);
    return 0;
    
    
    std::string in_path("/home/chi/JHUIT/raw/");
    std::string out_path("img_tmp/");
    std::string inst_name("driller_kel_0");
    std::string seq_id("1");;
    
    float elev = ELEV;
    int max_frames = 200;
    pcl::console::parse_argument(argc, argv, "--p", in_path);
    pcl::console::parse_argument(argc, argv, "--s", seq_id);
    pcl::console::parse_argument(argc, argv, "--i", inst_name);
    pcl::console::parse_argument(argc, argv, "--elev", elev);
    pcl::console::parse_argument(argc, argv, "--max", max_frames);
        
    std::cerr << "Loading-"<< inst_name << std::endl;
    if( exists_dir(out_path) == false )
            boost::filesystem::create_directories(out_path);
    
    std::ifstream fp;
    fp.open((in_path+"/PlaneCoef_"+ seq_id + ".txt").c_str(), std::ios::in);
    if( fp.is_open() == false )
    {
        std::cerr << "Failed to open: " << in_path+"/PlaneCoef_"+ seq_id + ".txt" << std::endl;
        exit(0);
    }
    pcl::ModelCoefficients::Ptr planeCoef(new pcl::ModelCoefficients());
    planeCoef->values.resize(4);
    fp >> planeCoef->values[0] >> planeCoef->values[1] >> planeCoef->values[2] >> planeCoef->values[3];
    fp.close();
    
    std::vector< pcl::PointCloud<PointT>::Ptr > cloud_set;
    std::vector< KEYSET > keypt_set;
    std::vector< cv::Mat > keydescr_set;
    
    for( size_t j = 0 ; j < max_frames ; j++ )
    {
        std::stringstream ss;
        ss << j;
        
        if( j % 3 != 0 )
            continue;
        
        std::string filename(in_path + inst_name + "/" + inst_name + "_" + seq_id + "_" + ss.str() + ".pcd");
        
        if( exists_test(filename) == false )
            continue;
        
        pcl::PointCloud<PointT>::Ptr cloud(new pcl::PointCloud<PointT>());
        pcl::io::loadPCDFile(filename, *cloud);
        
        int w = cloud->width;
        int h = cloud->height;
        
        //std::cerr << w << " " << h << " " << cloud->size() << std::endl;
        
        cv::Mat rgb = cv::Mat::zeros(h, w, CV_8UC3);
        cv::Mat gray = cv::Mat::zeros(h, w, CV_8UC1);

        for(size_t i = 0 ; i < cloud->size() ; i++ )
        {
            int r_idx = i / w;
            int c_idx = i % w;
            
            uint32_t rgb_tmp = cloud->at(i).rgba;
            rgb.at<uchar>(r_idx, c_idx*3+2) = (rgb_tmp >> 16) & 0x0000ff;
            rgb.at<uchar>(r_idx, c_idx*3+1) = (rgb_tmp >> 8)  & 0x0000ff;
            rgb.at<uchar>(r_idx, c_idx*3+0) = (rgb_tmp)       & 0x0000ff;  
            
        }
        
        cv::cvtColor(rgb,gray,CV_BGR2GRAY);
        
        //cv::imshow("GRAY", rgb);
        //cv::waitKey();
        
        cv::SiftFeatureDetector *sift_det = new cv::SiftFeatureDetector(
            0, // nFeatures
            4, // nOctaveLayers
            0.04, // contrastThreshold 
            10, //edgeThreshold
            1.6 //sigma
            );
    
        cv::SiftDescriptorExtractor * sift_ext = new cv::SiftDescriptorExtractor();
        
        KEYSET keypoints;
        cv::Mat descriptors;
        sift_det->detect(gray, keypoints);
        sift_ext->compute(gray, keypoints, descriptors);
        printf("%d sift keypoints are found.\n", (int)keypoints.size());

        keypt_set.push_back(keypoints);
        keydescr_set.push_back(descriptors);
        
        cloud = cropCloud(cloud, planeCoef, 0.114);
        cloud_set.push_back(cloud);
        
        //cv::imshow("GRAY", in_rgb);
        //cv::waitKey();
        //cv::imwrite(out_path + ss.str() + ".jpg", in_rgb);
        
        //viewer->addPointCloud(cloud, "cloud");
        //viewer->spin();
        //if( show_keys )
        /*
        {
            cv::Mat out_image;
            cv::drawKeypoints(gray, keypoints, out_image);
            cv::imshow("keypoints", out_image);
            cv::waitKey();
        }
        //*/
        
    }
    
    int total = cloud_set.size();
    /*
    std::vector< pcl::PointCloud<PointT>::Ptr > first_half, second_half;
    std::vector< KEYSET > first_keypt, second_keypt;
    std::vector< cv::Mat > first_keydescr, second_keydescr;
    
    first_half.insert(first_half.end(), cloud_set.begin(), cloud_set.begin()+total/2);
    first_keypt.insert(first_keypt.end(), keypt_set.begin(), keypt_set.begin()+total/2);
    first_keydescr.insert(first_keydescr.end(), keydescr_set.begin(), keydescr_set.begin()+total/2);
    
    second_half.push_back(cloud_set[0]);
    second_keypt.push_back(keypt_set[0]);
    second_keydescr.push_back(keydescr_set[0]);
    for( int i = 1 ; i < total/2 ; i++ )
    {
        second_half.push_back(cloud_set[total-i]);
        second_keypt.push_back(keypt_set[total-i]);
        second_keydescr.push_back(keydescr_set[total-i]);
    }
    
    pcl::PointCloud<PointT>::Ptr first_model = Meshing(first_half, first_keypt, first_keydescr);
    pcl::PointCloud<PointT>::Ptr second_model = Meshing(second_half, second_keypt, second_keydescr);
    pcl::PointCloud<PointT>::Ptr full_model (new pcl::PointCloud<PointT>());
    full_model->insert(full_model->end(), first_model->begin(), first_model->end());
    full_model->insert(full_model->end(), second_model->begin(), second_model->end());
    */
    pcl::PointCloud<PointT>::Ptr full_model = Meshing(cloud_set, keypt_set, keydescr_set);
    
    full_model = cropCloud(full_model, planeCoef, elev);
    
    pcl::io::savePCDFile("temp_full.pcd", *full_model);
    
    pcl::PLYWriter ply_writer;
    ply_writer.write("temp_full.ply", *full_model, true);
    
    /*
    pcl::PointCloud<PointT>::Ptr full_model(new pcl::PointCloud<PointT>());
    pcl::io::loadPCDFile("temp_full.pcd", *full_model);
    
    std::vector<int> idx_ff;
    pcl::removeNaNFromPointCloud(*full_model, *full_model, idx_ff);
    
    pcl::PointCloud<NormalT>::Ptr full_model_normals (new pcl::PointCloud<NormalT>());
    computeNormals(full_model, full_model_normals, 0.02);
    
    AdjustCloudNormal(full_model, full_model_normals);
    
    pcl::visualization::PCLVisualizer::Ptr viewer(new pcl::visualization::PCLVisualizer());
    viewer->initCameraParameters();
    viewer->addCoordinateSystem(0.1);
    viewer->setCameraPosition(0, 0, 0.1, 0, 0, 1, 0, -1, 0);
    
    //viewer->addPointCloud(full_model,  "full_model");
    //viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR, 1.0, 1.0, 1.0, "full_model");
    //viewer->addPointCloudNormals<PointT, NormalT> (full_model, full_model_normals, 5, 0.01, "normals");
    //viewer->spin();
    
    pcl::PointCloud<pcl::PointNormal>::Ptr joint_model (new pcl::PointCloud<pcl::PointNormal>());
    
    pcl::copyPointCloud(*full_model, *joint_model);
    pcl::copyPointCloud(*full_model_normals, *joint_model);
    
    //std::cerr << full_model->size() << " " << full_model_normals->size() << " " << joint_model->size() << std::endl;
    
    //pcl::concatenateFields (*full_model, *full_model_normals, *joint_model);
    pcl::search::KdTree<pcl::PointNormal>::Ptr tree2(new pcl::search::KdTree<pcl::PointNormal>);
    tree2->setInputCloud (joint_model);
    
    pcl::GreedyProjectionTriangulation<pcl::PointNormal> gp3;
    pcl::PolygonMesh model_mesh;

    gp3.setMu(2.5);
    gp3.setMaximumNearestNeighbors(100);
    gp3.setSearchRadius(0.03);
    gp3.setMaximumSurfaceAngle(M_PI/4);         // 45 degrees
    gp3.setMinimumAngle(M_PI/18);               // 10 degrees
    gp3.setMaximumAngle(2*M_PI/3);              // 120 degrees
    gp3.setNormalConsistency(false);

    // Get result
    gp3.setInputCloud (joint_model);
    gp3.setSearchMethod (tree2);
    gp3.reconstruct (model_mesh);
    
    //viewer->addPointCloud(full_model, "model");
    viewer->addPolygonMesh(model_mesh, "full_model_mesh");
    viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR, 1.0, 0.55, 0.05, "full_model_mesh");
    viewer->spin();
    */
    
    return 0;
}
void Extract(ExtractParameters* extractparams)
{
	FileSystem fs;
	if (fs.Open(extractparams->file))
	{
		if (!CreateDir(extractparams->out_path))
		{
			FILEPACKER_LOGE("ERROR: Unable to create %s\n", extractparams->out_path);
			return;
		}

		std::string out_path(extractparams->out_path);
		std::set<std::string> dirs;
		auto it = fs.Entries().begin();
		for (; it != fs.Entries().end(); it++)
		{
			const FileEntry& entry = it->second;
			size_t found = entry.path.find_last_of("/\\");
			if (found != std::string::npos)
			{
				std::string path = entry.path.substr(0, found);
				found = 0;
				while (1)
				{
					found = path.find_first_of("/\\", found);
					std::string curr = path.substr(0, found);
					if (dirs.find(curr) == dirs.end())
					{
						std::string full_dir = out_path + "/" + curr;
						if (!CreateDir(full_dir.c_str()))
						{
							FILEPACKER_LOGE("ERROR: Unable to create %s\n", full_dir.c_str());
						}
						else
						{
							FILEPACKER_LOGV(" + Created dir %s\n", curr.c_str());
						}

						dirs.insert(curr);
					}

					if (found == std::string::npos)
						break;

					found++;
				}
			}

			unsigned char* buffer = new unsigned char[entry.header.uncompr_size];
			fs.Read(entry, buffer);

			std::string full_dir = out_path + "/" + entry.path;
			FILE* f = fopen(full_dir.c_str(), "wb+");
			if (f != NULL)
			{
				FILEPACKER_LOGV(" + Writing %s\n", entry.path.c_str());
				fwrite(buffer, 1, entry.header.uncompr_size, f);
				fclose(f);
			}
			else
			{
				FILEPACKER_LOGE("ERROR: Unable to write %s\n", entry.path.c_str());
			}
		}
	}
	else
	{
		FILEPACKER_LOGE("ERROR: Unable to open %s\n", extractparams->file);
	}
}
// [ref] ${VXL_HOME}/contrib/mul/msm/tools/msm_draw_points_on_image.cxx
int msm_draw_points_on_image_example(int argc, char *argv[])
{
	vul_arg<vcl_string> curves_path("-c", "File containing curves");
	vul_arg<vcl_string> pts_path("-p", "File containing points");
	vul_arg<vcl_string> image_path("-i", "Image");
	vul_arg<vcl_string> out_path("-o", "Output path","image+pts.eps");
	vul_arg<vcl_string> line_colour("-lc", "Line colour","yellow");
	vul_arg<vcl_string> pt_colour("-pc", "Point colour","none");
	vul_arg<vcl_string> pt_edge_colour("-pbc", "Point border colour","none");
	vul_arg<double> pt_radius("-pr", "Point radius",2.0);
	vul_arg<double> scale("-s", "Scaling to apply",1.0);

	vul_arg_parse(argc, argv);

	if (pts_path() == "")
	{
		local::print_usage();
		return 0;
	}

	msm_curves curves;
	if (curves_path() != "" && !curves.read_text_file(curves_path()))
		vcl_cerr << "Failed to read in curves from " << curves_path() << vcl_endl;

	msm_points points;
	if (!points.read_text_file(pts_path()))
	{
		vcl_cerr << "Failed to read points from " << pts_path() << vcl_endl;
		return 2;
	}
	vcl_vector<vgl_point_2d<double> > pts;
	points.get_points(pts);

	//================ Attempt to load image ========
	vil_image_view<vxl_byte> image;
	if (image_path() != "")
	{
		image = vil_load(image_path().c_str());
		if (image.size() == 0)
		{
			vcl_cout << "Failed to load image from " << image_path() << vcl_endl;
			return 1;
		}
		vcl_cout << "Image is " << image << vcl_endl;
	}

	if (scale() > 1.001 || scale() < 0.999)
	{
		// Scale image and points
		vil_image_view<vxl_byte> image2;
		image2.deep_copy(image);
		if (scale() < 0.51)
			vil_gauss_filter_2d(image, image2, 1.0, 3);
		vil_resample_bilin(image2, image, int(0.5 + scale() * image.ni()), int(0.5 + scale() * image.nj()));

		points.scale_by(scale());
	}


	// Compute bounding box of points
	vgl_box_2d<double> bbox = points.bounds();
	bbox.scale_about_centroid(1.05);  // Add a border

	// If an image is supplied, use that to define bounding box
	if (image.size() > 0)
	{
		bbox = vgl_box_2d<double>(0, image.ni(), 0,image.nj());
	}

	vgl_point_2d<double> blo = bbox.min_point();

	// Translate all points to allow for shift of origin
	points.translate_by(-blo.x(), -blo.y());

	mbl_eps_writer writer(out_path().c_str(), bbox.width(), bbox.height());

	if (image.size() > 0)
		writer.draw_image(image, 0, 0, 1, 1);

	if (pt_colour() != "none")
	{
		// Draw all the points
		writer.set_colour(pt_colour());
		msm_draw_points_to_eps(writer, points, pt_radius());
	}

	if (pt_edge_colour() != "none")
	{
		// Draw disks around all the points
		writer.set_colour(pt_edge_colour());
		msm_draw_points_to_eps(writer, points, pt_radius(), false);
	}

	if (curves.size() > 0 && line_colour() != "none")
	{
		// Draw all the lines
		writer.set_colour(line_colour());
		msm_draw_shape_to_eps(writer, points, curves);
	}
	writer.close();

	vcl_cout << "Graphics saved to " << out_path() << vcl_endl;

	return 0;
}
void user_settings_io::export_settings(const std::string& output_dir)
{
  if(!settings_file_name_.empty())
  {
    namespace fs = boost::filesystem;
    std::string config_dir = output_dir + "/config";
    fs::path out_path(config_dir);
    fs::create_directory(out_path);

    YAML::Emitter out;
    out << YAML::BeginMap;
    out << YAML::Key << usc::fs;
    out << YAML::Value << settings_.get_fs();

    out << YAML::Key << usc::forces_dynamic;
    out << YAML::Value << settings_.get_forces_dynamic();

    out << YAML::Key << usc::excitation_time_step;
    out << YAML::Value << settings_.get_excitation_time_step();

    out << YAML::Key << usc::excitation_time;
    out << YAML::Value << settings_.get_excitation_time();

    out << YAML::Key << usc::rtss::self;
    out << YAML::BeginMap;
    out << YAML::Key << usc::rtss::initial_step;
    out << YAML::Value << settings_.get_relaxation_time_step_spec().initial_step;
    out << YAML::Key << usc::rtss::time_delta;
    out << YAML::Value << settings_.get_relaxation_time_step_spec().time_delta;
    out << YAML::Key << usc::rtss::coefficient;
    out << YAML::Value << settings_.get_relaxation_time_step_spec().coefficient;
    out << YAML::EndMap;

    out << YAML::Key << usc::simulations_count;
    out << YAML::Value << settings_.get_simulations_count();

    out << YAML::Key << usc::visualization_nodes;
    out << YAML::Value << YAML::BeginSeq;
    const auto& vis_nodes = settings_.get_visualization_nodes();
    for(auto it = vis_nodes.begin(); it != vis_nodes.end(); ++it)
    {
      out << *it;
    }
    out << YAML::EndSeq;

    if(!settings_.get_force_application_nodes().empty())
    {
      out << YAML::Key << usc::force_application_nodes;
      out << YAML::Value << YAML::BeginSeq;
      const auto& force_nodes = settings_.get_force_application_nodes();
      for(auto it = force_nodes.begin(); it != force_nodes.end(); ++it)
      {
        out << *it;
      }
      out << YAML::EndSeq;
    }

    if(settings_.get_cutoff_distance())
    {
      out << YAML::Key << usc::l0;
      out << YAML::Value << *settings_.get_cutoff_distance();
    }
    if(!settings_.get_network_file_path())
    {
      if(settings_.get_node_positions())
      {
        out << YAML::Key << usc::nodes;
        const node_positions_type& node_positions = *settings_.get_node_positions();
        out << YAML::Value << YAML::BeginSeq;
        for(auto it = node_positions.begin(); it != node_positions.end(); ++it)
        {
          out << YAML::BeginSeq;
          out << (*it)[0];
          out << (*it)[1];
          out << (*it)[2];
          out << YAML::EndSeq;
        }
        out << YAML::EndSeq;
      }
      if(settings_.get_links())
      {
        out << YAML::Key << usc::links;
        out << YAML::Value << YAML::BeginSeq;
        const std::vector<std::pair<std::size_t, std::size_t>>& links = *settings_.get_links();
        for(auto it = links.begin(); it != links.end(); ++it)
        {
          out << YAML::BeginSeq << it->first << it->second << YAML::EndSeq;
        }
        out << YAML::EndSeq;
      }
    }
    else
    {
      out << YAML::Key << usc::network_file_path;
      /**
       * @note Output only network file name as it will anyway be copied to the same directory as user config.
       */
      std::string file_name = *settings_.get_network_file_path();
      if(std::string::npos != file_name.find_first_of('/'))
      {
        file_name = file_name.substr(file_name.find_last_of('/')+1);
      }
      out << YAML::Value << file_name;
    }
    out << YAML::EndMap;

    std::ofstream fout(config_dir + "/config.yaml");
    if(!fout.is_open())
    {
      LOG(logger::error, "Cannot create output config file.");
      return;
    }
    fout << out.c_str() << std::endl;
    fout.close();

    if(settings_.get_network_file_path())
    {
      utils::copy_file(*settings_.get_network_file_path(), config_dir);
    }
  }
}