|
@@ -53,10 +53,11 @@
|
|
|
ImageLabeler::ImageLabeler(QWidget *aParent, QString aSettingsPath) :
|
|
|
QMainWindow(aParent)
|
|
|
{
|
|
|
+ setFocusPolicy(Qt::StrongFocus);
|
|
|
+
|
|
|
/*
|
|
|
* Variables
|
|
|
*/
|
|
|
-
|
|
|
list_images_ = new QList< Image >;
|
|
|
|
|
|
main_label_ = -1;
|
|
@@ -835,7 +836,7 @@ ImageLabeler::addImage(Image *anImage)
|
|
|
|
|
|
QString itemText = QString("%1: %2").
|
|
|
arg(list_images_widget_->count()).
|
|
|
- arg(getFilenameFromPath(&(anImage->image_)));
|
|
|
+ arg(removePath(anImage->image_));
|
|
|
if (anImage->labeled_)
|
|
|
itemText.append(" #labeled");
|
|
|
if (anImage->pas_)
|
|
@@ -1507,7 +1508,7 @@ ImageLabeler::nextImage()
|
|
|
/* NOTREACHED */
|
|
|
}
|
|
|
|
|
|
- if (askForUnsavedData()) {
|
|
|
+ if (!askForUnsavedData()) {
|
|
|
return;
|
|
|
/* NOTREACHED */
|
|
|
}
|
|
@@ -1563,7 +1564,7 @@ ImageLabeler::prevImage()
|
|
|
/* NOTREACHED */
|
|
|
}
|
|
|
|
|
|
- if (askForUnsavedData()) {
|
|
|
+ if (!askForUnsavedData()) {
|
|
|
return;
|
|
|
/* NOTREACHED */
|
|
|
}
|
|
@@ -1681,7 +1682,7 @@ ImageLabeler::saveAllInfo()
|
|
|
fileDialog.setAcceptMode(QFileDialog::AcceptSave);
|
|
|
fileDialog.setDefaultSuffix("dat");
|
|
|
fileDialog.setFileMode(QFileDialog::AnyFile);
|
|
|
- QString dir = getDirFromPath(¤t_image_);
|
|
|
+ QString dir = getPathFromFilename(current_image_);
|
|
|
|
|
|
/* altering the name of a new file */
|
|
|
QString newFileName = alterFileName(current_image_, "_labeled");
|
|
@@ -1740,7 +1741,7 @@ ImageLabeler::saveSegmentedPicture()
|
|
|
fileDialog.setAcceptMode(QFileDialog::AcceptSave);
|
|
|
fileDialog.setDefaultSuffix("png");
|
|
|
fileDialog.setFileMode(QFileDialog::AnyFile);
|
|
|
- QString dir = getDirFromPath(¤t_image_);
|
|
|
+ QString dir = getPathFromFilename(current_image_);
|
|
|
|
|
|
/* altering the name of a new file */
|
|
|
QString newFileName = alterFileName(current_image_, "_segmented");
|
|
@@ -1845,7 +1846,7 @@ ImageLabeler::saveLegend()
|
|
|
fileDialog.setAcceptMode(QFileDialog::AcceptSave);
|
|
|
fileDialog.setDefaultSuffix("dat");
|
|
|
fileDialog.setFileMode(QFileDialog::AnyFile);
|
|
|
- QString dir = getDirFromPath(¤t_image_);
|
|
|
+ QString dir = getPathFromFilename(current_image_);
|
|
|
|
|
|
/* altering the name of a new file */
|
|
|
QString newFileName = alterFileName(current_image_, "_legend");
|
|
@@ -1888,7 +1889,7 @@ ImageLabeler::saveLegend()
|
|
|
void
|
|
|
ImageLabeler::loadInfo()
|
|
|
{
|
|
|
- if (askForUnsavedData()) {
|
|
|
+ if (!askForUnsavedData()) {
|
|
|
return;
|
|
|
/* NOTREACHED */
|
|
|
}
|
|
@@ -2068,7 +2069,7 @@ ImageLabeler::loadInfo(QString filename)
|
|
|
void
|
|
|
ImageLabeler::loadPascalFile()
|
|
|
{
|
|
|
- if (askForUnsavedData()) {
|
|
|
+ if (!askForUnsavedData()) {
|
|
|
return;
|
|
|
/* NOTREACHED */
|
|
|
}
|
|
@@ -2463,7 +2464,7 @@ ImageLabeler::loadPascalPolys(QString aFilename)
|
|
|
void
|
|
|
ImageLabeler::loadImage()
|
|
|
{
|
|
|
- if (askForUnsavedData()) {
|
|
|
+ if (!askForUnsavedData()) {
|
|
|
return;
|
|
|
/* NOTREACHED */
|
|
|
}
|
|
@@ -2557,7 +2558,7 @@ ImageLabeler::loadImage()
|
|
|
void
|
|
|
ImageLabeler::loadImages()
|
|
|
{
|
|
|
- if (askForUnsavedData()) {
|
|
|
+ if (!askForUnsavedData()) {
|
|
|
return;
|
|
|
/* NOTREACHED */
|
|
|
}
|
|
@@ -3908,7 +3909,7 @@ ImageLabeler::removeImage()
|
|
|
list_images_->takeAt(num);
|
|
|
|
|
|
for (int i = num ; i < list_images_widget_->count(); i++) {
|
|
|
- QString newStr = getFilenameFromPath(&(list_images_->at(i).image_));
|
|
|
+ QString newStr = removePath(list_images_->at(i).image_);
|
|
|
newStr.prepend(QString("%1: ").arg(i));
|
|
|
list_images_widget_->item(i)->setText(newStr);
|
|
|
}
|