mirror of https://github.com/CGAL/cgal
move images
This commit is contained in:
parent
f581ff74d3
commit
44df66485d
|
|
@ -28,6 +28,7 @@
|
|||
#include <limits>
|
||||
#include <set>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
|
|
@ -164,6 +165,11 @@ public:
|
|||
return private_read(::_readImage(file));
|
||||
}
|
||||
|
||||
bool read(const std::string& file)
|
||||
{
|
||||
return read(file.c_str());
|
||||
}
|
||||
|
||||
bool read_raw(const char* file,
|
||||
const unsigned int rx,
|
||||
const unsigned int ry,
|
||||
|
|
|
|||
|
|
@ -191,28 +191,12 @@ int main() {
|
|||
image.set_data(nullptr); // trick to avoid ~Image_3 segfault.
|
||||
|
||||
|
||||
const char* filenames[] = {
|
||||
"data/skull_2.9.inr",
|
||||
"../../examples/Surface_mesher/data/skull_2.9.inr",
|
||||
"../../../Surface_mesher/examples/Surface_mesher/data/skull_2.9.inr",
|
||||
"../Surface_mesher_Examples/data/skull_2.9.inr"
|
||||
};
|
||||
const std::string filename = CGAL::data_file_path("images/skull_2.9.inr");
|
||||
|
||||
std::size_t file_index = 0;
|
||||
for( ; file_index < sizeof(filenames); ++file_index)
|
||||
{
|
||||
std::ifstream image_file(filenames[file_index], std::ios_base::binary | std::ios_base::in );
|
||||
if(image_file) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assert(file_index < sizeof(filenames) );
|
||||
|
||||
std::cerr << "Opening file " << filenames[file_index] << "...\n";
|
||||
std::cerr << "Opening file " << filename << "...\n";
|
||||
|
||||
CGAL::Image_3 image2;
|
||||
const bool result = image2.read(filenames[file_index]);
|
||||
const bool result = image2.read(filename);
|
||||
assert(result);
|
||||
|
||||
std::cerr << "Image info:"
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -28,7 +28,7 @@ using namespace CGAL::parameters;
|
|||
|
||||
int main(int argc, char*argv[])
|
||||
{
|
||||
const char* fname = (argc>1)?argv[1]:"data/skull_2.9.inr";
|
||||
const std::string fname = (argc>1)?argv[1]:CGAL::data_file_path("images/skull_2.9.inr");
|
||||
// Load image
|
||||
CGAL::Image_3 image;
|
||||
if(!image.read(fname)){
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ struct Image_to_multiple_iso_level_sets {
|
|||
|
||||
int main(int argc, char*argv[])
|
||||
{
|
||||
const char* fname = (argc>1)?argv[1]:"data/skull_2.9.inr";
|
||||
const std::string fname = (argc>1)?argv[1]:CGAL::data_file_path("images/skull_2.9.inr");
|
||||
// Load image
|
||||
CGAL::Image_3 image;
|
||||
if(!image.read(fname)){
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ using namespace CGAL::parameters;
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
const char* fname = (argc > 1) ? argv[1] : "data/skull_2.9.inr";
|
||||
const std::string fname = (argc > 1) ? argv[1] : CGAL::data_file_path("images/skull_2.9.inr");
|
||||
/// [Load image]
|
||||
CGAL::Image_3 image;
|
||||
if (!image.read(fname)) {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ using namespace CGAL::parameters;
|
|||
int main(int argc, char* argv[])
|
||||
{
|
||||
/// [Loads image]
|
||||
const char* fname = (argc>1)?argv[1]:"data/liver.inr.gz";
|
||||
const std::string fname = (argc>1)?argv[1]:CGAL::data_file_path("images/liver.inr.gz");
|
||||
CGAL::Image_3 image;
|
||||
if(!image.read(fname)){
|
||||
std::cerr << "Error: Cannot read file " << fname << std::endl;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ using namespace CGAL::parameters;
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
const char* fname = (argc>1)?argv[1]:"data/liver.inr.gz";
|
||||
const std::string fname = (argc>1)?argv[1]:CGAL::data_file_path("images/liver.inr.gz");
|
||||
// Loads image
|
||||
CGAL::Image_3 image;
|
||||
if(!image.read(fname)){
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ using namespace CGAL::parameters;
|
|||
// not documented.
|
||||
bool add_1D_features(const CGAL::Image_3& image,
|
||||
Mesh_domain& domain,
|
||||
const char* lines_fname)
|
||||
const std::string lines_fname)
|
||||
{
|
||||
typedef K::Point_3 Point_3;
|
||||
typedef unsigned char Word_type;
|
||||
|
|
@ -72,7 +72,7 @@ bool add_1D_features(const CGAL::Image_3& image,
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
const char* fname = (argc>1)?argv[1]:"data/420.inr";
|
||||
const std::string fname = (argc>1)?argv[1]:CGAL::data_file_path("images/420.inr");
|
||||
// Loads image
|
||||
CGAL::Image_3 image;
|
||||
if(!image.read(fname)){
|
||||
|
|
@ -84,7 +84,7 @@ int main(int argc, char* argv[])
|
|||
Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image);
|
||||
|
||||
/// Declare 1D-features, see above [Call add_1D_features]
|
||||
const char* lines_fname = (argc>2)?argv[2]:"data/420.polylines.txt";
|
||||
const std::string lines_fname = (argc>2)?argv[2]:CGAL::data_file_path("images/420.polylines.txt");
|
||||
|
||||
if(!add_1D_features(image, domain, lines_fname)) {
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ using namespace CGAL::parameters;
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
const char* fname = (argc>1)?argv[1]:"data/liver.inr.gz";
|
||||
const std::string fname = (argc>1)?argv[1]:CGAL::data_file_path("images/liver.inr.gz");
|
||||
// Domain
|
||||
CGAL::Image_3 image;
|
||||
if(!image.read(fname)){
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ using namespace CGAL::parameters;
|
|||
|
||||
int main(int argc, char*argv[])
|
||||
{
|
||||
const char* fname = (argc>1)?argv[1]:"data/liver.inr.gz";
|
||||
const std::string fname = (argc>1)?argv[1]:CGAL::data_file_path("images/liver.inr.gz");
|
||||
// Domain
|
||||
CGAL::Image_3 image;
|
||||
if(!image.read(fname)){
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include <fstream>
|
||||
|
||||
template <typename Point_3>
|
||||
bool read_polylines(const char* fname,
|
||||
bool read_polylines(const std::string fname,
|
||||
std::vector<std::vector<Point_3> >& polylines)
|
||||
{
|
||||
std::ifstream ifs(fname);
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -55,7 +55,7 @@ public:
|
|||
// Data generation
|
||||
//-------------------------------------------------------
|
||||
Image image;
|
||||
if (!image.read("data/skull_2.9.inr"))
|
||||
if (!image.read(CGAL::data_file_path("images/skull_2.9.inr")))
|
||||
{
|
||||
std::cout << "Image reading error. Exit test.\n";
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public:
|
|||
// Data generation
|
||||
//-------------------------------------------------------
|
||||
Image image;
|
||||
if (!image.read("data/skull_2.9.inr"))
|
||||
if (!image.read(CGAL::data_file_path("images/skull_2.9.inr")))
|
||||
{
|
||||
std::cout << "Image reading error. Exit test.\n";
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public:
|
|||
// Data generation
|
||||
//-------------------------------------------------------
|
||||
Image image;
|
||||
image.read("data/liver.inr.gz");
|
||||
image.read(CGAL::data_file_path("images/liver.inr.gz"));
|
||||
|
||||
std::cout << "\tSeed is\t"
|
||||
<< CGAL::get_default_random().get_seed() << std::endl;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
// Data generation
|
||||
//-------------------------------------------------------
|
||||
Image image;
|
||||
image.read("data/liver.inr.gz");
|
||||
image.read(CGAL::data_file_path("images/liver.inr.gz"));
|
||||
|
||||
std::cout << "\tSeed is\t"
|
||||
<< CGAL::get_default_random().get_seed() << std::endl;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -22,7 +22,7 @@ int main() {
|
|||
C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation
|
||||
|
||||
// the 'function' is a 3D gray level image
|
||||
Gray_level_image image("data/skull_2.9.inr", 2.9f);
|
||||
Gray_level_image image(CGAL::data_file_path("images/skull_2.9.inr"), 2.9f);
|
||||
|
||||
// Carefully chosen bounding sphere: the center must be inside the
|
||||
// surface defined by 'image' and the radius must be high enough so that
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include <CGAL/auto_link/ImageIO.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#ifdef CGAL_SURFACE_MESHER_DEBUG_GRAY_LEVEL_IMAGE_3_CONSTRUCTOR
|
||||
#include <boost/format.hpp>
|
||||
|
|
@ -44,7 +45,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
Gray_level_image_3(const char* file, float isoval, bool positive_inside_=true, float value_outside = 0.f)
|
||||
Gray_level_image_3(const std::string& file, float isoval, bool positive_inside_=true, float value_outside = 0.f)
|
||||
: Image_3(),
|
||||
isovalue(isoval),
|
||||
positive_inside(positive_inside_),
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -32,7 +32,7 @@ using namespace CGAL::parameters;
|
|||
|
||||
int main()
|
||||
{
|
||||
const char* filename = "data/liver.inr.gz";
|
||||
const std::string filename = CGAL::data_file_path("images/liver.inr.gz");
|
||||
|
||||
CGAL::Image_3 image;
|
||||
if (!image.read(filename)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue