Skip to content

Commit

Permalink
Drishti-2.6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
AjayLimaye committed Nov 26, 2018
1 parent 39f0313 commit 2dd83f4
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 21 deletions.
2 changes: 1 addition & 1 deletion tools/paint/drishtipaint.ui
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@
</action>
<action name="actionExportMask">
<property name="text">
<string>Export .mask</string>
<string>Export .rawmask</string>
</property>
</action>
<action name="actionDeleteCheckpoint">
Expand Down
14 changes: 8 additions & 6 deletions tools/paint/volumefilemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1177,23 +1177,23 @@ VolumeFileManager::saveMemFile()

}

void
QString
VolumeFileManager::exportMask()
{
QString flnm;
flnm = QFileDialog::getSaveFileName(0,
"Export to .mask file",
"Export to .rawmask file",
Global::previousDirectory(),
"Mask Files (*.mask)",
"Mask Files (*.rawmask)",
0,
QFileDialog::DontUseNativeDialog);


if (flnm.isEmpty())
return;
return QString();

if (!StaticFunctions::checkExtension(flnm, ".mask"))
flnm += ".mask";
if (!StaticFunctions::checkExtension(flnm, ".rawmask"))
flnm += ".rawmask";

uchar vt;
if (m_voxelType == _UChar) vt = 0; // unsigned byte
Expand Down Expand Up @@ -1232,6 +1232,8 @@ VolumeFileManager::exportMask()
m_qfile.close();

progress.setValue(100);

return flnm;
}

void
Expand Down
2 changes: 1 addition & 1 deletion tools/paint/volumefilemanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class VolumeFileManager : public QObject
QString fileName();
bool exists();

void exportMask();
QString exportMask();
void checkPoint();
bool loadCheckPoint();
bool loadCheckPoint(QString);
Expand Down
32 changes: 19 additions & 13 deletions tools/paint/volumemask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ VolumeMask::reset()
void
VolumeMask::exportMask()
{
m_maskFileManager.exportMask();
QString maskfile = m_maskFileManager.exportMask();
if (!maskfile.isEmpty())
createPvlNc(maskfile);
}
void
VolumeMask::checkPoint()
Expand Down Expand Up @@ -184,13 +186,8 @@ VolumeMask::setGridSize(int d, int w, int h, int slabsize)
}

void
VolumeMask::checkMaskFile()
VolumeMask::createPvlNc(QString maskfile)
{
// create mask file if not present
if (!m_maskFileManager.exists())
{
m_maskFileManager.createFile(true, true);

QDomDocument doc("Drishti_Header");

QDomElement topElement = doc.createElement("PvlDotNcFileHeader");
Expand All @@ -206,9 +203,9 @@ VolumeMask::checkMaskFile()
{
QDomElement de0 = doc.createElement("pvlnames");
QDomText tn0;
QFileInfo fileInfo(m_maskfile);
QFileInfo fileInfo(maskfile);
QDir direc = fileInfo.absoluteDir();
QString vstr = direc.relativeFilePath(m_maskfile);
QString vstr = direc.relativeFilePath(maskfile);
tn0 = doc.createTextNode(vstr);
de0.appendChild(tn0);
topElement.appendChild(de0);
Expand Down Expand Up @@ -270,17 +267,26 @@ VolumeMask::checkMaskFile()
topElement.appendChild(de0);
}

QString pvlfile = m_maskfile;
//pvlfile.chop(4);
QString pvlfile = maskfile;
pvlfile += ".pvl.nc";
QFile pf(pvlfile.toLatin1().data());
if (pf.open(QIODevice::WriteOnly))
{
QTextStream out(&pf);
doc.save(out, 2);
pf.close();
}

}
}

void
VolumeMask::checkMaskFile()
{
// create mask file if not present
if (!m_maskFileManager.exists())
{
m_maskFileManager.createFile(true, true);

createPvlNc(m_maskfile);
}
}

Expand Down
1 change: 1 addition & 0 deletions tools/paint/volumemask.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class VolumeMask : public QObject
uchar* m_maskslice;

void checkMaskFile();
void createPvlNc(QString);
};

#endif

0 comments on commit 2dd83f4

Please sign in to comment.