-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetrekRemoveBlank.cpp
More file actions
executable file
·40 lines (32 loc) · 1.01 KB
/
detrekRemoveBlank.cpp
File metadata and controls
executable file
·40 lines (32 loc) · 1.01 KB
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
/** @author Yao-Wang Li
* @date 2018-10-14
* @email: liyaowang2911@gmail.com
* @version: 0.1
* @brief convert the rigaku image to tiff format image, the center blank will be removed before conversion.
*/
#include <cstdlib>
#include "detrek.h"
int main (int argc, char ** argv)
{
if (argc != 2)
{
std::cout<<"I need the detrek image file name, thank you."<<std::endl;
exit(1);
}
string fileName=string(argv[1]);
int position=fileName.find_last_of(".");
if (fileName.substr(position+1)!="img")
{
std::cout<<"it is not an image with the extension 'img'."<<std::endl;
exit(2);
}
string baseName=fileName.substr(0, position);
string outFileName=baseName + ".tif";
std::cout<<"This program can convert the rigaku two dimensional diffraction image to tiff format image."<<std::endl;
std::cout<<"Have fun with this program, good luck to you. from Yao-Wang. "<<std::endl;
detrek rigakuImg(fileName);
rigakuImg.printHeaderInfo();
rigakuImg.cutCenterBlank();
rigakuImg.writeTifImage(outFileName);
return 0;
}