File: test_imageio.cpp

package info (click to toggle)
cgal 4.9-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 85,584 kB
  • sloc: cpp: 640,841; ansic: 140,696; sh: 708; fortran: 131; makefile: 114; python: 92
file content (68 lines) | stat: -rw-r--r-- 1,441 bytes parent folder | download | duplicates (2)
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
65
66
67
68
#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)
	<<"\nimage offset"
	<< SHOW(tx)
	<< SHOW(ty)
	<< SHOW(tz)
	<<"\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();
}