mirror of
https://github.com/brmlab/medirap.git
synced 2025-12-15 21:53:58 +01:00
rework on slicing and thresholding
This commit is contained in:
parent
8039ff529a
commit
bc839e5d7c
5 changed files with 75 additions and 67 deletions
|
|
@ -6,28 +6,23 @@
|
|||
|
||||
bool VoxelData::load(QString path, QString filename)
|
||||
{
|
||||
data.clear();
|
||||
qDebug() << "Processing " + path + "/" + filename + " ...";
|
||||
QFile file(path + "/" + filename);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
return false;
|
||||
QTextStream in(&file);
|
||||
int z = 0;
|
||||
data = new VOXELDATA[512*512*512];
|
||||
while (!in.atEnd()) {
|
||||
QString line = in.readLine();
|
||||
QImage img;
|
||||
qDebug() << "Loading " + line + " ...";
|
||||
img.load(path + "/" + line);
|
||||
dimx = img.width();
|
||||
dimy = img.height();
|
||||
for (int x = 0; x < dimx; ++x) {
|
||||
for (int y = 0; y < dimy; ++y) {
|
||||
data[ x + y*512 + z*512*512] = img.pixel(x,y) & 0xFF;
|
||||
}
|
||||
}
|
||||
z++;
|
||||
data.push_back(new QImage(path + "/" + line));
|
||||
}
|
||||
dimz = z;
|
||||
dimz = data.size();
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
const QImage *VoxelData::getSlice(int z)
|
||||
{
|
||||
return data[z];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue