-
Notifications
You must be signed in to change notification settings - Fork 2
/
volumeinformation.cpp
49 lines (41 loc) · 1.54 KB
/
volumeinformation.cpp
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
#include "volumeinformation.h"
#include "ui_volumeinformation.h"
VolumeInformation::VolumeInformation(QWidget *parent) :
QDialog(parent),
ui(new Ui::VolumeInformation)
{
ui->setupUi(this);
}
VolumeInformation::~VolumeInformation()
{
delete ui;
}
void VolumeInformation::showVolumeInformation(const iftImage *img,QString filename)
{
char str[200];
if (img != nullptr){
ui->lblImagePath->setText(filename);
float voxel_size;
if (iftIs3DImage(img)) {
voxel_size = img->dx*img->dy*img->dz;
sprintf(str,"%f x %f x %f = %f units³",img->dx,img->dy,img->dz,voxel_size);
} else {
voxel_size = img->dx*img->dy;
sprintf(str,"%f x %f = %f units²",img->dx,img->dy,voxel_size);
}
ui->lblVoxelSize->setText(str);
if (iftIs3DImage(img)) {
int image_size = img->xsize*img->ysize*img->zsize;
sprintf(str,"%d x %d x %d = %d (%.2f units² )",img->xsize,img->ysize,img->zsize,image_size,voxel_size*image_size);
} else {
int image_size = img->xsize*img->ysize;
sprintf(str,"%d x %d = %d (%.2f units³)",img->xsize,img->ysize,image_size,voxel_size*image_size);
}
ui->lblImageDomain->setText(str);
int depth = iftImageDepth(img);
sprintf(str,"%.0f (%d bits)",pow(2,depth),depth);
ui->lblLabelDepth->setText(str);
sprintf(str,"Maximum value: %d, Minimum value: %d",iftMaximumValue(img),iftMinimumValue(img));
ui->lblMaxAndMinValues->setText(str);
}
}