.. _lab_1: Lab work 1 ---------- This lab work is aimed at putting into practice the concepts of raster image and vectorial image, how to create raster images and how to read, save and filter them. The work consists of developing a python_ application of image creation and processing using the libraries matplotlib_, skimage_ and pyqt_ among others. The lab is divided into several parts. Each week, this document will be updated with new contents. The project must be developed in teams using the git repository image_viewer_ . 1. Introduction to python and gitlab ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The first 2 sessions of lab will be devoted to refreshing (or learning from scratch) the python_ programming language, and to learn how to use a gitlab repository. You don't have to deliver anything in these two sessions, just learn and practice on your own. After that, and with more or less hours of personal work depending on your previous programming skills, you should be able to program simple scripts in python, verify your code passing doctests, implement python classes based on their specification and use high-level libraries such as matplotlib_ and skimage_. Slides: ^^^^^^^ * slides-lab-1_ * slides-lab-2_ 2. Raster images creation ~~~~~~~~~~~~~~~~~~~~~~~~~ Clone the image_viewer_ repository. You'll see that it has a preliminary implementation of the class :py:class:`RImage`, a class aimed at representing a raster image: its name, its matrix of pixels and other attributes that we'll implement step to step. Check at the specification of the class :ref:`rimage `. Understand the specification. In a python interpreter, try to create an RGB image of 500 pixels width by 300 pixels heigth corresponding to the color salmon (hex code: #FA8072). Verify that the implementation is correct by passing the doctests in the tests directory. Slides: ^^^^^^^ * slides-lab-3_ Homework: ^^^^^^^^^ You should find 2 issues in your repository. Solve them. - Add a new procedural image by simply modifying the dictionary of the class. - Add a new class method for image creating following the description of your assigned issue. The expected result of the different types of images obtained is shown below. .. image:: result.png Remember the systematic work approach when using git after you have cloned the project: - You fetch the changes: **git fetch** - You verify in which branch you are: **git status** - If you are not in the branch where you want to work: **git checkout name_branch** - Download the changes in the current branch: **git pull** - Work locally - When done: **git add** *modified_or_new_files* (or **git rm** to remove files) - Commit the changes locally: **git commit -m** "*comment the changes*" - Push the changes to the cloud: **git push** 3. Filters ~~~~~~~~~~ For each of the image filtering and processing families studied in theory, add at least an example method different from those tested in class. Slides: ^^^^^^^ * slides-lab-4_ .. _image_viewer: https://gitlab-gie.cs.upc.edu/medical-images/image-viewer .. _python: https://www.python.org/ .. _matplotlib: https://matplotlib.org/ .. _skimage: https://scikit-image.org/ .. _pyqt: https://www.riverbankcomputing.com/static/Docs/PyQt5/ .. _slides-lab-1: https://www.cs.upc.edu/~dani/IM/session1lab.pdf .. _slides-lab-2: https://www.cs.upc.edu/~dani/IM/session2lab.pdf .. _slides-lab-3: https://www.cs.upc.edu/~dani/IM/session3lab.pdf .. _slides-lab-4: https://www.cs.upc.edu/~dani/IM/session4lab.pdf .. _draw: https://scikit-image.org/docs/dev/api/skimage.draw.html#skimage.draw.circle .. _Mondrian: https://ca.wikipedia.org/wiki/Piet_Mondrian .. _test-visual: ./programs/test-visual.html .. _test-contrast: ./programs/test-contrast.html .. _test-histogram: ./programs/test-histogram.html