Sfoglia il codice sorgente

-full code documentation implemented
-manual added

gapchich 13 anni fa
parent
commit
9eef2d41ea
10 ha cambiato i file con 61 aggiunte e 14 eliminazioni
  1. 2 2
      ImageHolder.h
  2. 6 6
      ImageLabeler.cpp
  3. 2 2
      ImageLabeler.h
  4. BIN
      ImageLabeler_manual.odt
  5. BIN
      ImageLabeler_manual.pdf
  6. 12 0
      LineEditForm.cpp
  7. 11 2
      LineEditForm.h
  8. 16 1
      OptionsForm.cpp
  9. 12 0
      functions.cpp
  10. 0 1
      main.cpp

+ 2 - 2
ImageHolder.h

@@ -23,7 +23,7 @@ struct BoundingBox {
 	int label_ID_;
 };
 
-//! structure containing list of the polygon points and it's label ID
+//! structure containing list of the polygon points and polygon's label ID
 struct Polygon {
 	QPolygon poly;
 	int label_ID_;
@@ -138,7 +138,7 @@ private:
 	//! \see ImageLabeler::list_label_color_
 	QList< uint > *list_label_color_;
 
-	//! \brief list of points for the undo\redo methods
+	//! \brief list of points for the undo/redo methods
 	//! \see undo()
 	//! \see redo()
 	QList< QPoint > list_poly_history_;

+ 6 - 6
ImageLabeler.cpp

@@ -3,7 +3,7 @@
  * \brief implementation of the ImageLabeler class
  *
  * Main widget which contains all GUI elements
- * and connect them with each other.
+ * and connects them with each other.
  *
  *  Created on: Oct 4, 2011
  *      Author: Gapchich Vladislav
@@ -44,7 +44,7 @@
  *	\param[in,out] aParent a pointer to the parent widget.
  *	If aParent is 0, then ImageLabeler becomes a window, otherwise
  *	it becomes a child of some other widget
- *	\param[in] aSettingPath alters the path to the file with settings
+ *	\param[in] aSettingsPath alters the path to the file with settings
  *	(default path is /path/to/binary/ImageLabeler.ini)
  *
  *	A constructor is responsible for allocating memory for all the
@@ -1350,7 +1350,7 @@ ImageLabeler::deleteArea(QListWidgetItem *anItem)
 	return true;
 }
 
-//! A slot member toggling the priority of current item(main\not main)
+//! A slot member toggling the priority of current item(main/not main)
 /*!
  * \see toggleLabelPriority(QListWidgetItem *anItem)
  * Slot not just only toggles current label priority but also checks other labels
@@ -1363,7 +1363,7 @@ ImageLabeler::toggleLabelPriority()
 		showWarning(tr("An error occurred while toggling a label priority"));
 }
 
-//! A slot member toggling the priority of current item(main\not main)
+//! A slot member toggling the priority of current item(main/not main)
 /*!
  * \param[in] anItem a pointer to the QListWidgetItem object which corresponds to
  * some certain label
@@ -3938,8 +3938,8 @@ ImageLabeler::mousePressEvent(QMouseEvent *anEvent)
 //! A protected member which is being automatically called on every key press
 /*!
  * current list of available commands:
- * - key left\right - prevImage() \ nextImage()
- * - enter\return - confirmSelection()
+ * - key left/right - prevImage() / nextImage()
+ * - enter/return - confirmSelection()
  * - esc - clear current selection
  * - ctrl+z - image_holder_->undo()
  * - ctrl+y - iamge_holder_->redo()

+ 2 - 2
ImageLabeler.h

@@ -34,7 +34,7 @@ class QDomDocument;
 class QDomElement;
 class QSettings;
 
-//! Keeps flags for the image
+//! Structure keeps path to the image and it's flags
 /*
  * \see loadInfo(QString filename)
  * \see loadPascalFile(QString aFilename, QString aPath)
@@ -472,7 +472,7 @@ private:
 	QString old_area_string_;
 
 	/* options */
-	//! enables\disables automatic color generation before image segmenting
+	//! enables/disables automatic color generation before image segmenting
 	bool auto_color_generation_;
 
 	/* flags */

BIN
ImageLabeler_manual.odt


BIN
ImageLabeler_manual.pdf


+ 12 - 0
LineEditForm.cpp

@@ -15,6 +15,11 @@
 #include <QDesktopWidget>
 #include <QKeyEvent>
 
+//! A constructor
+/*!
+ * Constructor is responsible for allocating memory for all the GUI,
+ * arranging and connecting them in the right order.
+ */
 LineEditForm::LineEditForm(QWidget *aParent)
 	: QWidget(aParent)
 {
@@ -49,10 +54,12 @@ LineEditForm::LineEditForm(QWidget *aParent)
 		SLOT(hide())
 		);
 
+	/* moving form to the center of the screen */
 	adjustSize();
 	move(QApplication::desktop()->screen()->rect().center() - rect().center());
 }
 
+//! A destructor
 LineEditForm::~LineEditForm()
 {
 	delete data_;
@@ -62,6 +69,7 @@ LineEditForm::~LineEditForm()
 	delete layout_v_;
 }
 
+//! Transmits data to any reciever by dataSet(QString aData)
 void
 LineEditForm::setData()
 {
@@ -79,6 +87,7 @@ LineEditForm::setData()
 			);
 }
 
+//! Showing form and setting proper purpose(ImageDescriptionPurpose)
 void
 LineEditForm::setDescription()
 {
@@ -88,6 +97,7 @@ LineEditForm::setDescription()
 	show();
 }
 
+//! Showing form and setting proper purpose(TaggingPurpose)
 void
 LineEditForm::setTags()
 {
@@ -97,12 +107,14 @@ LineEditForm::setTags()
 	show();
 }
 
+//! Returns current purpose of the form
 FormPurpose
 LineEditForm::purpose()
 {
 	return purpose_;
 }
 
+//! An event which is automatically called on every key press
 void
 LineEditForm::keyPressEvent(QKeyEvent *anEvent)
 {

+ 11 - 2
LineEditForm.h

@@ -1,5 +1,5 @@
-/*
- * ImageDescriptionForm.h
+/*!
+ * \file ImageDescriptionForm.h
  *
  *  Created on: Oct 6, 2011
  *      Author: Gapchich Vlad
@@ -16,12 +16,19 @@ class QVBoxLayout;
 class QHBoxLayout;
 class QKeyEvent;
 
+//! Enum indicating the purpose why the form was called
 enum FormPurpose {
 	NoPurpose,
 	ImageDescriptionPurpose,
 	TaggingPurpose
 };
 
+//! \brief A widget with one-line text editor which can be used both for
+//! image description or adding tags for the image
+/*!
+ * The number of purposes can be increased by simple adding another purpose
+ * to the FormPurpose enum and managing it in the code of this class
+ */
 class LineEditForm : public QWidget {
 	Q_OBJECT
 protected:
@@ -40,6 +47,7 @@ signals:
 	void dataSet(QString aData);
 
 private:
+	//! one-line text editor
 	QLineEdit *data_;
 	QPushButton *button_ok_;
 	QPushButton *button_cancel_;
@@ -47,6 +55,7 @@ private:
 	QVBoxLayout *layout_v_;
 	QHBoxLayout *layout_h_;
 
+	//! keeps the purpose why LineEditForm was called
 	FormPurpose purpose_;
 };
 

+ 16 - 1
OptionsForm.cpp

@@ -18,6 +18,11 @@
 #include <QFileDialog>
 #include <QKeyEvent>
 
+//! A constructor
+/*!
+ * Constructor is responsible for allocating memory for all the GUI,
+ * arranging and connecting them in the right order.
+ */
 OptionsForm::OptionsForm(QWidget *aParent)
 	: QWidget(aParent)
 {
@@ -75,12 +80,14 @@ OptionsForm::OptionsForm(QWidget *aParent)
 		SLOT(onPathEditing())
 		);
 
+	/* moving it to the center of the screen */
 	move(QApplication::desktop()->screen()->rect().center() - rect().center());
 }
 
+//! A destructor
 OptionsForm::~OptionsForm()
 {
-	delete auto_color_generation_;
+	delete auto_color_generation_box_;
 	delete button_set_PASCAL_root_;
 	delete edit_PASCAL_root_;
 	delete button_ok_;
@@ -89,6 +96,7 @@ OptionsForm::~OptionsForm()
 	delete layout_v_;
 }
 
+//! A slot member confirming all the changes in options
 void
 OptionsForm::setOptions()
 {
@@ -96,6 +104,7 @@ OptionsForm::setOptions()
 	hide();
 }
 
+//! Sets a pointer on the ImageLabeler::PASCALpath_
 void
 OptionsForm::setPASCALpath(QString *aPath)
 {
@@ -107,6 +116,7 @@ OptionsForm::setPASCALpath(QString *aPath)
 	PASCALpath_ = aPath;
 }
 
+//! Asks user for the new path to the PASCAL "root" folder
 void
 OptionsForm::newPascalPath()
 {
@@ -129,12 +139,14 @@ OptionsForm::newPascalPath()
 	edit_PASCAL_root_->setText(newPath);
 }
 
+//! Returns auto_color_generation_box_ status
 bool
 OptionsForm::autoColorGeneration()
 {
 	return auto_color_generation_box_->isChecked();
 }
 
+//! Sets auto_color_generation_box_ status
 void
 OptionsForm::setAutoColorGeneration(bool *flag)
 {
@@ -142,6 +154,7 @@ OptionsForm::setAutoColorGeneration(bool *flag)
 	auto_color_generation_ = flag;
 }
 
+//! A slot member showing the form and initializing widgets
 void
 OptionsForm::showOptions()
 {
@@ -158,6 +171,7 @@ OptionsForm::showOptions()
 	show();
 }
 
+//! A slot member validating path to the PASCAL "root" folder typed by user
 void
 OptionsForm::onPathEditing()
 {
@@ -169,6 +183,7 @@ OptionsForm::onPathEditing()
 		edit_PASCAL_root_->setText(*PASCALpath_);
 }
 
+//! An event which is automatically called on every key press
 void
 OptionsForm::keyPressEvent(QKeyEvent *anEvent)
 {

+ 12 - 0
functions.cpp

@@ -14,6 +14,18 @@
 #include <QDomText>
 #include <QDebug>
 
+//! Gets number from a string which is located between aFirstStr and aSecondStr
+/*!
+ * \param[in] aString pointer to the source string containing the number we need
+ * \param[in] aFirstStr a string which is located to the left side of the number
+ * \param[in] aSecondStr a string which is located to the right side of the number
+ * \param[in,out] anOkFlag a pointer to the bool flag indicating the conversation errors
+ *
+ * example: aString contains "0: Poly #0; LabelID: 1; points:..."
+ * aFirstStr "LabelID: "
+ * aSecondStr ";"
+ * function returns 1
+ */
 int
 getNumFromString(
 	QString *aString,

+ 0 - 1
main.cpp

@@ -5,7 +5,6 @@
 
 #include "ImageLabeler.h"
 
-/* TODO: make list_areas_ and list_areas_widget_ separately */
 int main(int argc, char *argv[])
 {
 	QApplication app(argc, argv);