Skip to content

Commit 7b9113a

Browse files
committed
Merge pull request #6034 from sloriot/CGAL_data-moving_files
CGAL Data: doc + more data moves
2 parents 101b794 + dc6b58d commit 7b9113a

32 files changed

+41
-37
lines changed

CGAL_ImageIO/include/CGAL/Image_3.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <limits>
2929
#include <set>
3030
#include <cstdlib>
31+
#include <string>
3132

3233
#if defined(BOOST_MSVC)
3334
# pragma warning(push)
@@ -164,6 +165,11 @@ class CGAL_IMAGEIO_EXPORT Image_3
164165
return private_read(::_readImage(file));
165166
}
166167

168+
bool read(const std::string& file)
169+
{
170+
return read(file.c_str());
171+
}
172+
167173
bool read_raw(const char* file,
168174
const unsigned int rx,
169175
const unsigned int ry,

CGAL_ImageIO/test/CGAL_ImageIO/test_trilinear_interpolation.cpp

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -191,28 +191,12 @@ int main() {
191191
image.set_data(nullptr); // trick to avoid ~Image_3 segfault.
192192

193193

194-
const char* filenames[] = {
195-
"data/skull_2.9.inr",
196-
"../../examples/Surface_mesher/data/skull_2.9.inr",
197-
"../../../Surface_mesher/examples/Surface_mesher/data/skull_2.9.inr",
198-
"../Surface_mesher_Examples/data/skull_2.9.inr"
199-
};
200-
201-
std::size_t file_index = 0;
202-
for( ; file_index < sizeof(filenames); ++file_index)
203-
{
204-
std::ifstream image_file(filenames[file_index], std::ios_base::binary | std::ios_base::in );
205-
if(image_file) {
206-
break;
207-
}
208-
}
209-
210-
assert(file_index < sizeof(filenames) );
194+
const std::string filename = CGAL::data_file_path("images/skull_2.9.inr");
211195

212-
std::cerr << "Opening file " << filenames[file_index] << "...\n";
196+
std::cerr << "Opening file " << filename << "...\n";
213197

214198
CGAL::Image_3 image2;
215-
const bool result = image2.read(filenames[file_index]);
199+
const bool result = image2.read(filename);
216200
assert(result);
217201

218202
std::cerr << "Image info:"
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)