OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
InitGridWithPixel.hpp File Reference

Header file containing functions for loading pixel values from 2D image or 3D image stack (volume) stored in a binary file onto an openFPM grid. More...

#include <iostream>
#include <typeinfo>
#include <cmath>
#include <sys/stat.h>
#include "Vector/vector_dist.hpp"
#include "Grid/grid_dist_id.hpp"
#include "data_type/aggregate.hpp"
#include "Decomposition/CartDecomposition.hpp"
#include "level_set/redistancing_Sussman/HelpFunctionsForGrid.hpp"

Go to the source code of this file.

Typedefs

typedef signed char BYTE
 

Functions

bool exists_test (const std::string &name)
 
std::vector< int > get_size (const std::string &path_to_file)
 Read the number of pixels per dimension from a csv-file in order to create a grid with the same size.
 
template<size_t Phi_0, typename grid_type >
void load_pixel_onto_grid (grid_type &grid, std::string file_name, std::vector< int > &stack_dims)
 Converts the pixel values stored in a binary file into doubles and loads them onto an OpenFPM grid.
 

Detailed Description

Header file containing functions for loading pixel values from 2D image or 3D image stack (volume) stored in a binary file onto an openFPM grid.

Can be run in parallel.

Author
Justina Stark & Pietro Incardona
Date
November 2019 - August 2020

Definition in file InitGridWithPixel.hpp.

Typedef Documentation

◆ BYTE

typedef signed char BYTE

Definition at line 29 of file InitGridWithPixel.hpp.

Function Documentation

◆ exists_test()

bool exists_test ( const std::string &  name)
inline

Definition at line 31 of file InitGridWithPixel.hpp.

◆ get_size()

std::vector< int > get_size ( const std::string &  path_to_file)

Read the number of pixels per dimension from a csv-file in order to create a grid with the same size.

Parameters
path_to_fileStd::string containing the path to the csv file that holds the image/volume size in pixels per dimension.
Returns
Std::vector containing the count of pixels for each dimension as it was read from the csv file.

Definition at line 44 of file InitGridWithPixel.hpp.

◆ load_pixel_onto_grid()

template<size_t Phi_0, typename grid_type >
void load_pixel_onto_grid ( grid_type grid,
std::string  file_name,
std::vector< int > &  stack_dims 
)

Converts the pixel values stored in a binary file into doubles and loads them onto an OpenFPM grid.

Template Parameters
Phi_0Index of property in which pixel value should be stored.
grid_typeType of OpenFPM grid.
Parameters
gridGrid of type grid_type, on which image / image-stack should be loaded.
file_nameStd::string containing the path + name of the binary file that stores the pixel values.
stack_dimsSize_t variable that contains the dimensionality of the image / image stack. Can be given manually or loaded from a csv file before (see: get_size())

Definition at line 92 of file InitGridWithPixel.hpp.