Skip to content

Commit

Permalink
Drishti Paint : Ask for image plane when saving images.
Browse files Browse the repository at this point in the history
  • Loading branch information
AjayLimaye committed Mar 21, 2018
1 parent db672f9 commit 8c67d57
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
25 changes: 24 additions & 1 deletion tools/paint/drishtipaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,30 @@ DrishtiPaint::on_actionAbout_triggered()
}


void DrishtiPaint::on_saveImage_triggered() { m_axialImage->saveImage(); }
void DrishtiPaint::on_saveImage_triggered()
{
QStringList itype;
itype << "Z";
itype << "Y";
itype << "X";
bool ok;
QString option = QInputDialog::getItem(0,
"Save Image Slice",
"Image plane",
itype,
0,
false,
&ok);
if (ok)
{
if (option.contains("Z"))
m_axialImage->saveImage();
else if (option.contains("Y"))
m_sagitalImage->saveImage();
else
m_coronalImage->saveImage();
}
}

void
DrishtiPaint::on_saveWork_triggered()
Expand Down
13 changes: 11 additions & 2 deletions tools/paint/imagewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,19 @@ ImageWidget::saveImage()
if (imgFile.isEmpty())
return;

if (!StaticFunctions::checkExtension(imgFile, ".png") &&
!StaticFunctions::checkExtension(imgFile, ".tif") &&
!StaticFunctions::checkExtension(imgFile, ".bmp") &&
!StaticFunctions::checkExtension(imgFile, ".jpg"))
imgFile += ".png";

QImage sImage = m_image;
QPainter p(&sImage);
p.setCompositionMode(QPainter::CompositionMode_Overlay);
p.drawImage(0,0, m_maskimage);

p.setRenderHint(QPainter::Antialiasing);
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
p.drawImage(0, 0, m_image);
p.drawImage(0, 0, m_maskimage);

sImage.save(imgFile);
QMessageBox::information(0, "Save Image", "Done");
Expand Down

0 comments on commit 8c67d57

Please sign in to comment.