Skip to content

Commit c5b40a1

Browse files
committed
name changed MeshData -> PixelData
1 parent df7b336 commit c5b40a1

27 files changed

+197
-199
lines changed

docs/lib_guide/lib_guide.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ \subsection{Particle Transforms}
183183
apr.particle_intensities.map(apr,absolute_value_of_intensities,[](const uint16_t &a) { return abs(a); });
184184
\end{lstlisting}
185185
\section{Pixel Images and Reconstruction}
186-
Pixel images are handled using the MeshData class and tiff library is used for input-output.
186+
Pixel images are handled using the PixelData class and tiff library is used for input-output.
187187
\subsection{Reconstruction}
188188
Any particle property, stored using ExtraParticleData class, can be interpolated to reconstruct an image, allowing both a piecewise constant and smooth reconstruction. For examples see Example\_reconstruct\_image.
189189
\subsection{Sampling particles from an image}

examples/Example_compress_apr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int main(int argc, char **argv) {
7070
apr.read_apr(options.directory + name + "_compress_apr.h5");
7171
timer.stop_timer();
7272

73-
MeshData<uint16_t> img;
73+
PixelData<uint16_t> img;
7474
apr.interp_img(img,apr.particles_intensities);
7575
std::string output = options.directory + name + "_compress.tif";
7676
TiffUtils::saveMeshAsTiff(output, img);

examples/Example_compute_gradient.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ int main(int argc, char **argv) {
7979
gradient.map(apr,gradient_magnitude,[](const std::vector<float> &a) { return 20.0f*sqrt(pow(a[0], 2.0f) + pow(a[1], 2.0f) + pow(a[2], 2.0f)); });
8080

8181
// write result to image
82-
MeshData<float> gradient_magnitude_image;
82+
PixelData<float> gradient_magnitude_image;
8383
apr.interp_img(gradient_magnitude_image,gradient_magnitude);
8484
//apr.interp_img(gradient_magnitude_image,apr.particles_intensities);
8585

@@ -96,9 +96,9 @@ int main(int argc, char **argv) {
9696
if(options.original_image.size() > 0) {
9797

9898
TiffUtils::TiffInfo inputTiff(options.directory + options.original_image);
99-
MeshData<uint16_t> original_image = TiffUtils::getMesh<uint16_t>(inputTiff);
99+
PixelData<uint16_t> original_image = TiffUtils::getMesh<uint16_t>(inputTiff);
100100

101-
std::vector<MeshData<float>> gradient_mesh;
101+
std::vector<PixelData<float>> gradient_mesh;
102102

103103
MeshNumerics::compute_gradient(original_image, gradient_mesh);
104104

examples/Example_get_apr.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ int main(int argc, char **argv) {
8282

8383
timer.verbose_flag = true;
8484

85-
MeshData<uint16_t> level;
85+
PixelData<uint16_t> level;
8686

8787
apr.interp_depth_ds(level);
8888

@@ -125,14 +125,14 @@ int main(int argc, char **argv) {
125125
unsigned int blosc_comp_level = options.compress_level;
126126
unsigned int blosc_shuffle = 1;
127127

128-
MeshData<uint16_t> recon_image;
128+
PixelData<uint16_t> recon_image;
129129

130130
apr.interp_img(recon_image, apr.particles_intensities);
131131

132132
TiffUtils::TiffInfo inputTiff(options.directory + options.input);
133-
MeshData<uint16_t> inputImage = TiffUtils::getMesh<uint16_t>(inputTiff);
133+
PixelData<uint16_t> inputImage = TiffUtils::getMesh<uint16_t>(inputTiff);
134134

135-
MeshData<int16_t> diff_image(inputImage.y_num,inputImage.x_num,inputImage.z_num,0);
135+
PixelData<int16_t> diff_image(inputImage.y_num,inputImage.x_num,inputImage.z_num,0);
136136

137137
#ifdef HAVE_OPENMP
138138
#pragma omp parallel for schedule(static)

examples/Example_get_apr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <string>
66

77
#include "algorithm/APRParameters.hpp"
8-
#include "data_structures/Mesh/MeshData.hpp"
8+
#include "data_structures/Mesh/PixelData.hpp"
99
#include "algorithm/APRConverter.hpp"
1010
#include "data_structures/APR/APR.hpp"
1111

examples/Example_ray_cast.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ int main(int argc, char **argv) {
6868

6969
apr_raycaster.name = apr.name;
7070

71-
MeshData<uint16_t> views;
71+
PixelData<uint16_t> views;
7272

7373
/////////////
7474
///
@@ -92,9 +92,9 @@ int main(int argc, char **argv) {
9292
if(options.original_image.size() > 0){
9393

9494
TiffUtils::TiffInfo inputTiff(options.directory + options.original_image);
95-
MeshData<uint16_t> original_image = TiffUtils::getMesh<uint16_t>(inputTiff);
95+
PixelData<uint16_t> original_image = TiffUtils::getMesh<uint16_t>(inputTiff);
9696

97-
MeshData<uint16_t> mesh_views;
97+
PixelData<uint16_t> mesh_views;
9898

9999
apr_raycaster.perpsective_mesh_raycast(original_image,mesh_views);
100100

examples/Example_reconstruct_image.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ int main(int argc, char **argv) {
127127

128128
if(options.output_pc_recon) {
129129
//create mesh data structure for reconstruction
130-
MeshData<uint16_t> recon_pc;
130+
PixelData<uint16_t> recon_pc;
131131

132132
timer.start_timer("pc interp");
133133
//perform piece-wise constant interpolation
@@ -179,7 +179,7 @@ int main(int argc, char **argv) {
179179

180180
// Intentionaly block-scoped since local type_recon will be destructed when block ends and release memory.
181181
{
182-
MeshData<uint16_t> type_recon;
182+
PixelData<uint16_t> type_recon;
183183

184184
apr.interp_img(type_recon, type);
185185
TiffUtils::saveMeshAsTiff(options.directory + apr.name + "_type.tif", type_recon);
@@ -205,7 +205,7 @@ int main(int argc, char **argv) {
205205
if(options.output_smooth_recon) {
206206

207207
//smooth reconstruction - requires float
208-
MeshData<float> recon_smooth;
208+
PixelData<float> recon_smooth;
209209
std::vector<float> scale_d = {2, 2, 2};
210210

211211
timer.start_timer("smooth reconstrution");

examples/Example_reconstruct_patch.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ int main(int argc, char **argv) {
191191

192192
if(options.output_pc_recon) {
193193
//create mesh data structure for reconstruction
194-
MeshData<uint16_t> recon_pc;
194+
PixelData<uint16_t> recon_pc;
195195

196196

197197

@@ -245,7 +245,7 @@ int main(int argc, char **argv) {
245245

246246
// Intentionaly block-scoped since local type_recon will be destructed when block ends and release memory.
247247
{
248-
MeshData<uint16_t> type_recon;
248+
PixelData<uint16_t> type_recon;
249249

250250
aprReconstruction.interp_image_patch(apr,type_recon, type,reconPatch);
251251
TiffUtils::saveMeshAsTiff(options.directory + apr.name + "_type.tif", type_recon);
@@ -291,7 +291,7 @@ int main(int argc, char **argv) {
291291

292292
// Intentionaly block-scoped since local type_recon will be destructed when block ends and release memory.
293293
{
294-
MeshData<uint8_t> type_recon;
294+
PixelData<uint8_t> type_recon;
295295

296296
//level
297297
aprReconstruction.interp_image_patch(apr,type_recon, level,reconPatch);

libapr.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ namespace std {
6868
#include "src/numerics/APRNumerics.hpp"
6969
%}
7070

71-
%include "src/data_structures/Mesh/MeshData.hpp"
71+
%include "src/data_structures/Mesh/PixelData.hpp"
7272
%include "src/data_structures/APR/APR.hpp"
7373
%include "src/data_structures/APR/APRIterator.hpp"
7474
%include "src/numerics/APRNumerics.hpp"

src/algorithm/APRConverter.hpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef PARTPLAY_APR_CONVERTER_HPP
1010
#define PARTPLAY_APR_CONVERTER_HPP
1111

12-
#include "../data_structures/Mesh/MeshData.hpp"
12+
#include "data_structures/Mesh/PixelData.hpp"
1313
#include "../io/TiffUtils.hpp"
1414
#include "../data_structures/APR/APR.hpp"
1515

@@ -51,30 +51,30 @@ class APRConverter: public LocalIntensityScale, public ComputeGradient, public L
5151
private:
5252
//get apr without setting parameters, and with an already loaded image.
5353
template<typename T>
54-
bool get_apr_method(APR<ImageType> &aAPR, MeshData<T> &input_image);
54+
bool get_apr_method(APR<ImageType> &aAPR, PixelData<T> &input_image);
5555

5656
//pointer to the APR structure so member functions can have access if they need
5757
const APR<ImageType> *apr;
5858

5959
template<typename T>
60-
void init_apr(APR<ImageType>& aAPR, MeshData<T>& input_image);
60+
void init_apr(APR<ImageType>& aAPR, PixelData<T>& input_image);
6161

6262
template<typename T>
63-
void auto_parameters(const MeshData<T> &input_img);
63+
void auto_parameters(const PixelData<T> &input_img);
6464

6565
template<typename T>
6666
bool get_apr_method_from_file(APR<ImageType> &aAPR, const TiffUtils::TiffInfo &aTiffFile);
6767

68-
void get_gradient(MeshData<ImageType> &image_temp, MeshData<ImageType> &grad_temp, MeshData<float> &local_scale_temp, MeshData<float> &local_scale_temp2, float bspline_offset);
69-
void get_local_intensity_scale(MeshData<float> &local_scale_temp, MeshData<float> &local_scale_temp2);
70-
void get_local_particle_cell_set(MeshData<ImageType> &grad_temp, MeshData<float> &local_scale_temp, MeshData<float> &local_scale_temp2);
68+
void get_gradient(PixelData<ImageType> &image_temp, PixelData<ImageType> &grad_temp, PixelData<float> &local_scale_temp, PixelData<float> &local_scale_temp2, float bspline_offset);
69+
void get_local_intensity_scale(PixelData<float> &local_scale_temp, PixelData<float> &local_scale_temp2);
70+
void get_local_particle_cell_set(PixelData<ImageType> &grad_temp, PixelData<float> &local_scale_temp, PixelData<float> &local_scale_temp2);
7171
};
7272

7373
template <typename T>
7474
struct MinMax{T min; T max; };
7575

7676
template <typename T>
77-
MinMax<T> getMinMax(const MeshData<T>& input_image) {
77+
MinMax<T> getMinMax(const PixelData<T>& input_image) {
7878
T minVal = std::numeric_limits<T>::max();
7979
T maxVal = std::numeric_limits<T>::min();
8080

@@ -96,7 +96,7 @@ MinMax<T> getMinMax(const MeshData<T>& input_image) {
9696
template<typename ImageType> template<typename T>
9797
bool APRConverter<ImageType>::get_apr_method_from_file(APR<ImageType> &aAPR, const TiffUtils::TiffInfo &aTiffFile) {
9898
allocation_timer.start_timer("read tif input image");
99-
MeshData<T> inputImage = TiffUtils::getMesh<T>(aTiffFile);
99+
PixelData<T> inputImage = TiffUtils::getMesh<T>(aTiffFile);
100100
allocation_timer.stop_timer();
101101

102102
method_timer.start_timer("calculate automatic parameters");
@@ -141,7 +141,7 @@ bool APRConverter<ImageType>::get_apr_method_from_file(APR<ImageType> &aAPR, con
141141
* Main method for constructing the APR from an input image
142142
*/
143143
template<typename ImageType> template<typename T>
144-
bool APRConverter<ImageType>::get_apr_method(APR<ImageType> &aAPR, MeshData<T>& input_image) {
144+
bool APRConverter<ImageType>::get_apr_method(APR<ImageType> &aAPR, PixelData<T>& input_image) {
145145
apr = &aAPR; // in case it was called directly
146146

147147
total_timer.start_timer("Total_pipeline_excluding_IO");
@@ -155,12 +155,12 @@ bool APRConverter<ImageType>::get_apr_method(APR<ImageType> &aAPR, MeshData<T>&
155155
//assuming uint16, the total memory cost shoudl be approximately (1 + 1 + 1/8 + 2/8 + 2/8) = 2 5/8 original image size in u16bit
156156
//storage of the particle cell tree for computing the pulling scheme
157157
allocation_timer.start_timer("init and copy image");
158-
MeshData<ImageType> image_temp(input_image, false /* don't copy */); // global image variable useful for passing between methods, or re-using memory (should be the only full sized copy of the image)
159-
MeshData<ImageType> grad_temp; // should be a down-sampled image
158+
PixelData<ImageType> image_temp(input_image, false /* don't copy */); // global image variable useful for passing between methods, or re-using memory (should be the only full sized copy of the image)
159+
PixelData<ImageType> grad_temp; // should be a down-sampled image
160160
grad_temp.initDownsampled(input_image.y_num, input_image.x_num, input_image.z_num, 0);
161-
MeshData<float> local_scale_temp; // Used as down-sampled images for some averaging steps where it is useful to not lose precision, or get over-flow errors
161+
PixelData<float> local_scale_temp; // Used as down-sampled images for some averaging steps where it is useful to not lose precision, or get over-flow errors
162162
local_scale_temp.initDownsampled(input_image.y_num, input_image.x_num, input_image.z_num);
163-
MeshData<float> local_scale_temp2;
163+
PixelData<float> local_scale_temp2;
164164
local_scale_temp2.initDownsampled(input_image.y_num, input_image.x_num, input_image.z_num);
165165
allocation_timer.stop_timer();
166166

@@ -206,7 +206,7 @@ bool APRConverter<ImageType>::get_apr_method(APR<ImageType> &aAPR, MeshData<T>&
206206
method_timer.stop_timer();
207207

208208
method_timer.start_timer("downsample_pyramid");
209-
std::vector<MeshData<T>> downsampled_img;
209+
std::vector<PixelData<T>> downsampled_img;
210210
//Down-sample the image for particle intensity estimation
211211
downsamplePyrmaid(input_image, downsampled_img, aAPR.level_max(), aAPR.level_min());
212212
method_timer.stop_timer();
@@ -229,7 +229,7 @@ bool APRConverter<ImageType>::get_apr_method(APR<ImageType> &aAPR, MeshData<T>&
229229
}
230230

231231
template<typename ImageType>
232-
void APRConverter<ImageType>::get_local_particle_cell_set(MeshData<ImageType> &grad_temp, MeshData<float> &local_scale_temp, MeshData<float> &local_scale_temp2) {
232+
void APRConverter<ImageType>::get_local_particle_cell_set(PixelData<ImageType> &grad_temp, PixelData<float> &local_scale_temp, PixelData<float> &local_scale_temp2) {
233233
//
234234
// Computes the Local Particle Cell Set from a down-sampled local intensity scale (\sigma) and gradient magnitude
235235
//
@@ -274,7 +274,7 @@ void APRConverter<ImageType>::get_local_particle_cell_set(MeshData<ImageType> &g
274274
}
275275

276276
template<typename ImageType>
277-
void APRConverter<ImageType>::get_gradient(MeshData<ImageType> &image_temp, MeshData<ImageType> &grad_temp, MeshData<float> &local_scale_temp, MeshData<float> &local_scale_temp2, float bspline_offset) {
277+
void APRConverter<ImageType>::get_gradient(PixelData<ImageType> &image_temp, PixelData<ImageType> &grad_temp, PixelData<float> &local_scale_temp, PixelData<float> &local_scale_temp2, float bspline_offset) {
278278
// Bevan Cheeseman 2018
279279
// Calculate the gradient from the input image. (You could replace this method with your own)
280280
// Input: full sized image.
@@ -335,7 +335,7 @@ void APRConverter<ImageType>::get_gradient(MeshData<ImageType> &image_temp, Mesh
335335
}
336336

337337
template<typename ImageType>
338-
void APRConverter<ImageType>::get_local_intensity_scale(MeshData<float> &local_scale_temp, MeshData<float> &local_scale_temp2) {
338+
void APRConverter<ImageType>::get_local_intensity_scale(PixelData<float> &local_scale_temp, PixelData<float> &local_scale_temp2) {
339339
//
340340
// Calculate the Local Intensity Scale (You could replace this method with your own)
341341
//
@@ -385,7 +385,7 @@ void APRConverter<ImageType>::get_local_intensity_scale(MeshData<float> &local_s
385385

386386

387387
template<typename ImageType> template<typename T>
388-
void APRConverter<ImageType>::init_apr(APR<ImageType>& aAPR,MeshData<T>& input_image){
388+
void APRConverter<ImageType>::init_apr(APR<ImageType>& aAPR,PixelData<T>& input_image){
389389
//
390390
// Initializing the size of the APR, min and maximum level (in the data structures it is called depth)
391391
//
@@ -406,7 +406,7 @@ void APRConverter<ImageType>::init_apr(APR<ImageType>& aAPR,MeshData<T>& input_i
406406
}
407407

408408
template<typename ImageType> template<typename T>
409-
void APRConverter<ImageType>::auto_parameters(const MeshData<T>& input_img){
409+
void APRConverter<ImageType>::auto_parameters(const PixelData<T>& input_img){
410410
//
411411
// Simple automatic parameter selection for 3D APR Flouresence Images
412412
//
@@ -484,7 +484,7 @@ void APRConverter<ImageType>::auto_parameters(const MeshData<T>& input_img){
484484
float proportion_flat = freq[0]/(counter*1.0f);
485485
float proportion_next = freq[1]/(counter*1.0f);
486486

487-
MeshData<T> histogram;
487+
PixelData<T> histogram;
488488
histogram.init(num_bins, 1, 1);
489489
std::copy(freq.begin(),freq.end(),histogram.mesh.begin());
490490

0 commit comments

Comments
 (0)