Developer documentation
Version 3.0.3-105-gd3941f44
tiff.h
Go to the documentation of this file.
1
/* Copyright (c) 2008-2022 the MRtrix3 contributors.
2
*
3
* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
*
7
* Covered Software is provided under this License on an "as is"
8
* basis, without warranty of any kind, either expressed, implied, or
9
* statutory, including, without limitation, warranties that the
10
* Covered Software is free of defects, merchantable, fit for a
11
* particular purpose or non-infringing.
12
* See the Mozilla Public License v. 2.0 for more details.
13
*
14
* For more details, see http://www.mrtrix.org/.
15
*/
16
17
#ifndef __file_tiff_h__
18
#define __file_tiff_h__
19
20
#include <tiffio.h>
21
22
#include "
mrtrix.h
"
23
#include "types.h"
24
#include "
debug.h
"
25
#include "
exception.h
"
26
#include "
file/path.h
"
27
28
namespace
MR
29
{
30
namespace
File
31
{
32
33
class
TIFF
34
{
MEMALIGN
(
TIFF
)
35
public
:
36
TIFF
(
const
std::string& filename,
const
char
* mode =
"r"
);
37
38
~TIFF
() {
39
if
(tif)
40
TIFFClose (tif);
41
}
42
43
template
<
typename
dtype>
44
void
read_and_check (ttag_t tag, dtype& var) {
45
dtype x;
46
if
(TIFFGetFieldDefaulted (tif, tag, &x) != 1)
47
return
;
48
if
(var && var != x)
49
throw
Exception
(std::string (
"mismatch between subfiles in TIFF image \""
) + TIFFFileName (tif) +
"\""
);
50
var = x;
51
}
52
53
int
read_directory () {
54
return
TIFFReadDirectory (tif);
55
}
56
57
size_t
scanline_size ()
const
{
return
TIFFScanlineSize (tif); }
58
void
read_scanline (tdata_t buf,
size_t
row,
size_t
sample = 0) { TIFFReadScanline (tif, buf, row, sample); }
59
60
private
:
61
::TIFF* tif;
62
63
static
void
error_handler (
const
char
* module,
const
char
* fmt, va_list ap);
64
};
65
66
}
67
}
68
69
#endif
70
71
72
MR::Exception
Definition:
exception.h:80
MR::File::TIFF
Definition:
tiff.h:34
debug.h
exception.h
mrtrix.h
MR
Definition:
base.h:24
path.h
MEMALIGN
#define MEMALIGN(...)
Definition:
types.h:185
core
file
tiff.h
Generated on Mon Jul 4 2022 08:00:06 for MRtrix by
1.9.3