-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (30 loc) · 877 Bytes
/
main.cpp
File metadata and controls
35 lines (30 loc) · 877 Bytes
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
#include <ccp4reader.h>
#include <EasyBMP/EasyBMP.h>
int main(int argc, char *argv[])
{
// 读文件
CCP4Reader reader;
VolumeData *densityData;
if(argc > 1) {
densityData = reader.read(argv[1]);
} else {
densityData = reader.read("data/emd_10410_96.map");
}
// BMP image可以做一个图片
int xPixelNum = densityData->size[0];
int yPixelNum = densityData->size[1];
BMP bpmImage;
bpmImage.SetSize(xPixelNum, yPixelNum);
bpmImage.SetBitDepth(24);
// 每个像素:计算结果颜色
for(int j = 0; j < densityData->size[1]; j++) {
for(int i = 0; i < densityData->size[1]; i++) {
bpmImage(i, j)->Red = 255;
bpmImage(i, j)->Green = 0;
bpmImage(i, j)->Blue = 0;
}
}
// 保存到文件
bpmImage.WriteToFile("result.bmp");
return 0;
}