Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
openfpm_io
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sbalzarini Lab
Software
Parallel Computing
OpenFPM
openfpm_io
Commits
41fcad3e
Commit
41fcad3e
authored
3 years ago
by
jstark
Browse files
Options
Downloads
Patches
Plain Diff
Changed image size type from size_t to int.
parent
6bf07eee
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Checking pipeline status
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/RawReader/InitGridWithPixel.hpp
+10
-10
10 additions, 10 deletions
src/RawReader/InitGridWithPixel.hpp
with
10 additions
and
10 deletions
src/RawReader/InitGridWithPixel.hpp
+
10
−
10
View file @
41fcad3e
...
...
@@ -41,9 +41,9 @@ inline bool exists_test (const std::string& name) {
* #pixels per dimension.
* @return Std::vector containing the count of pixels for each dimension as it was read from the csv file.
*/
std
::
vector
<
size_
t
>
get_size
(
const
std
::
string
&
path_to_file
)
std
::
vector
<
in
t
>
get_size
(
const
std
::
string
&
path_to_file
)
{
std
::
vector
<
size_
t
>
stack_dimst_1d
;
std
::
vector
<
in
t
>
stack_dimst_1d
;
// check if file exists and stream input csv file
if
(
!
exists_test
(
path_to_file
)){
std
::
cout
<<
"------------------------------------------------------------------------"
<<
std
::
endl
;
...
...
@@ -67,7 +67,7 @@ std::vector<size_t> get_size(const std::string & path_to_file)
while
(
getline
(
file
,
field
)
)
// 1 field per axis
{
std
::
istringstream
iss
(
field
);
size_
t
val
;
in
t
val
;
iss
>>
val
;
stack_dimst_1d
.
push_back
(
val
);
// add the #pixels for current axis to the array
}
...
...
@@ -89,7 +89,7 @@ std::vector<size_t> get_size(const std::string & path_to_file)
* manually or loaded from a csv file before (see: #get_size())
*/
template
<
size_t
Phi_0
,
typename
grid_type
>
void
load_pixel_onto_grid
(
grid_type
&
grid
,
std
::
string
file_name
,
std
::
vector
<
size_
t
>
&
stack_dims
)
void
load_pixel_onto_grid
(
grid_type
&
grid
,
std
::
string
file_name
,
std
::
vector
<
in
t
>
&
stack_dims
)
{
constexpr
size_t
x
=
0
;
constexpr
size_t
y
=
1
;
...
...
@@ -107,7 +107,7 @@ void load_pixel_onto_grid(grid_type & grid, std::string file_name, std::vector <
auto
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
rank
()
==
0
)
{
for
(
size_
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
for
(
in
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
{
std
::
cout
<<
"# grid points in dimension "
<<
d
<<
" = "
<<
grid
.
size
(
d
)
<<
std
::
endl
;
}
...
...
@@ -121,14 +121,14 @@ void load_pixel_onto_grid(grid_type & grid, std::string file_name, std::vector <
std
::
vector
<
BYTE
>
pixel_line
;
// one x-line of the image stack which will be read
size_t
sz_img
[
grid_type
::
dims
];
for
(
size_
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
for
(
in
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
{
sz_img
[
d
]
=
stack_dims
[
d
];
}
grid_sm
<
grid_type
::
dims
,
void
>
ginfo_image
(
sz_img
);
// in order to get the image related key later on
double
refinement
[
grid_type
::
dims
];
for
(
size_
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
for
(
in
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
{
refinement
[
d
]
=
(
double
)
grid
.
size
(
d
)
/
(
double
)
stack_dims
[
d
];
// get the factor, by which the grid resolution differs from the image stack resolution
if
(
v_cl
.
rank
()
==
0
)
std
::
cout
<<
"effective refinement in dimension "
<<
d
<<
" = "
<<
refinement
[
d
]
<<
std
::
endl
;
...
...
@@ -141,7 +141,7 @@ void load_pixel_onto_grid(grid_type & grid, std::string file_name, std::vector <
// In case a patch starts within a group of nodes to which same pixel-value should be assigned, get the
// respective rest-offset
size_
t
rest_offset
=
(
size_
t
)
(
fmod
(
gkey
.
get
(
0
),
refinement
[
x
]));
// get the remainder
in
t
rest_offset
=
(
in
t
)
(
fmod
(
gkey
.
get
(
0
),
refinement
[
x
]));
// get the remainder
// get l as the length of one x-line of the original image stack for the specific patch on the processor
...
...
@@ -154,7 +154,7 @@ void load_pixel_onto_grid(grid_type & grid, std::string file_name, std::vector <
// in case that the grid has a different resolution than the underlying image stack:
// create a key which is used to get the offset for the file reading
// the indices in this key are corrected by the refinement factor
for
(
size_
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
for
(
in
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
{
gkey
.
set_d
(
d
,
floor
(
gkey
.
get
(
d
)
/
refinement
[
d
]));
}
...
...
@@ -172,7 +172,7 @@ void load_pixel_onto_grid(grid_type & grid, std::string file_name, std::vector <
// run over a whole grid-line in x and assign pixel values from pixel_line to grid nodes
// if the grid is finer in x as the image stack, the same pixel value from pixel_line is
// assigned refinement[x] times
for
(
size_
t
k
=
0
;
k
<
patch_size
;
++
k
)
for
(
in
t
k
=
0
;
k
<
patch_size
;
++
k
)
{
auto
key
=
dom
.
get
();
// get the correct index of the pixel to be read from pixel_line by considering a potential rest-offset,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment