-
Notifications
You must be signed in to change notification settings - Fork 0
/
File.hpp
62 lines (42 loc) · 1.79 KB
/
File.hpp
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
#ifndef FILE_HPP_INCLUDE_GUARD_85438743843
#define FILE_HPP_INCLUDE_GUARD_85438743843
#include "UID.hpp"
#include "UIDs.hpp"
#include "Exceptions.hpp"
#include "FileMetaInformation.hpp"
#include <fstream>
namespace dicom
{
/*
What operations do we actually want to expose to the end user?
Basically,
Read from an istream onto a dataset.
Write from a dataset onto an ostream, appending appropriate meta info at begin...
so, maybe...
ReadFromStream(istream,dataset);
and then
WriteToStream(dataset,ostream);
all of which implies that File should be a hidden (implementation only) class.
One reason for keeping it visible would be so that users could go:
File f(...);
modify(f.data);
f.Write(...);
Alternatively, we could bundle all this functionality into DataSet:
DataSet ds(istream);
ds.Write(ostream);
and then maybe we wouldn't even have a file object.
*/
//!Thrown if we can't open the file, it's corrupt.
struct FileException:public dicom::exception
{
FileException(std::string Description):exception(Description){}
};
void ReadFileMetaFromStream(std::ifstream& In, DataSet& ds);
void ReadFromStream(std::ifstream& In, DataSet& data,size_t max_number_of_byte_to_read=-1);
void WriteToStream(const DataSet& data,std::ostream& Out,TS ts=TS(IMPL_VR_LE_TRANSFER_SYNTAX)/*::IMPL_VR_LE*/, bool Tiff=true);
void Read(std::string FileName,DataSet& data,size_t max_number_of_byte_to_read=-1);
void ReadW(std::wstring FileName, DataSet& data, size_t max_number_of_byte_to_read = -1);
void Write(const DataSet& data, std::string FileName, TS ts=TS(IMPL_VR_LE_TRANSFER_SYNTAX), bool Tiff=true);
void WriteW(const DataSet& data, std::wstring FileName, TS ts = TS(IMPL_VR_LE_TRANSFER_SYNTAX), bool Tiff = true);
}//namespace dicom
#endif //FILE_HPP_INCLUDE_GUARD_85438743843