File: test_imageio.cpp

package info (click to toggle)
cgal 4.0-5
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 65,068 kB
  • sloc: cpp: 500,870; ansic: 102,544; sh: 321; python: 92; makefile: 75; xml: 2
file content (64 lines) | stat: -rw-r--r-- 1,382 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <CGAL/ImageIO.h>
#include <iostream>

#define SHOW(attribut) "\n  "#attribut": " << image->attribut
#define SHOWENUM(enumitem) #enumitem"=" << enumitem

int main(int argc, char** argv)
{
  if(argc > 1)
  {
    _image* image = ::_readImage(argv[1]);
    if(image)
    {
      std::cerr 
	<< "Image infos:"
	<< "\ndimensions"
	<< SHOW(xdim)
	<< SHOW(ydim)
	<< SHOW(zdim)
	<< SHOW(vdim)
	<< "\nvoxel size"
	<< SHOW(vx)
	<< SHOW(vy)
	<< SHOW(vz)
	<<"\nrotation vector"
	<< SHOW(rx)
	<< SHOW(ry)
	<< SHOW(rz)
	<<"\nimage center"
	<< SHOW(cx)
	<< SHOW(cy)
	<< SHOW(cz)
	<< "\nword size (in bytes)"
	<< SHOW(wdim)
	<< "\nimage format"
	<< "\n  " << image->imageFormat->realName 
	<< " (extension list: " << image->imageFormat->fileExtension << ")" 
	<< "\nvectors interlaced or not ("
        << SHOWENUM(VM_INTERLACED) << ", "
        << SHOWENUM(VM_NON_INTERLACED) << ", "
        << SHOWENUM(VM_SCALAR) << ")"
	<< SHOW(vectMode)
	<< "\nword kind ("
	<< SHOWENUM(WK_FIXED) << ", "
	<< SHOWENUM(WK_FLOAT) << ", "
	<< SHOWENUM(WK_UNKNOWN)
	<< ")"
	<< SHOW(wordKind)
	<< "\nword sign ("
	<< SHOWENUM(SGN_SIGNED) << ", "
	<< SHOWENUM(SGN_UNSIGNED) << ", "
	<< SHOWENUM(SGN_UNKNOWN)
	<< ")"
	<< SHOW(sign)
	<< "\n";
      
      ::_freeImage(image);
    }
    else
      std::cerr << "\"" << argv[1] << "\" is not a supported file.\n";
  }
  else
    ::printSupportedFileFormat();
}