-
Notifications
You must be signed in to change notification settings - Fork 168
Exercises_2
Rebecca Leggett edited this page Aug 30, 2019
·
1 revision
Exercises 2 ¶
The goal of this exercise is for the programmer to become familiar with slightly more advanced features of the ISIS3 API. In this exercise you will be writing an ISIS3 application that does simple differences between adjacent pixels in the line or sample directions.
-
Exercises 2
- Setup
- Task 1 - Rename the copy of mirror to diff
- Task 2 - Modify the IsisMain and Processing function
- Task 3 - Add the ability to subtract the left neighbour
- Task 4 - Add the ability to subtract lines
- Task 5 - What about special pixels?
- Task 6 - Don't duplicate code
- Task 7 - Check your results
- Task 8 - Remove Global Variables
- Task 9 - Create tests for your new software
- Task 10 - Check code coverage
Setup ¶
Mirror is a good starting place, so it is advisable to copy the mirror directory from Exercise 1 to a new directory in base/apps called diff. The rest of the exercise will be based on this copied directory.
- Setup your environment to run the current public version of ISIS3
- Set your current working directory to the "diff" directory created above.
Task 1 - Rename the copy of mirror to diff ¶
- Make clean
- Rename all of the files to match your new application's name: diff .
- Edit the XML file to have only the FROM and TO parameters. Make sure they both have appropriate descriptions and add appropriate history documentation.
- Type make html to check the validity of your XML file. Fix any errors.
Task 2 - Modify the IsisMain and Processing function ¶
- Modify the IsisMain and process functions so they produce a new cube where each pixel is the subtraction of that pixel and its right neighbour. Example: If line 1 sample 1 has a value is 120 and line 1 sample 2 has a value of 153, the output pixel for line 1 sample 1 should be -33.
Task 3 - Add the ability to subtract the left neighbour ¶
- Create a new process function to subtract each pixel from its left neighbouring pixel.
- Create radio buttons in your XML (you may have to look at other apps to see an example) to allow the user to select between the two modes.
- Set up an if statement so your software can differentiate between the two modes. Hint: UserInterface can help you get the string value of the radio buttons. It may be useful to look at another application.
Task 4 - Add the ability to subtract lines ¶
- Now create another process function that subtracts lines instead of samples.
- Edit your XML file to accommodate this new feature.
- Don't forget make html to test your changes
- Don't forget to append to the if statement to accommodate the new mode. Hint: This may require a global variable.
Task 5 - What about special pixels? ¶
- Now you need to account for special pixels in the image. If either of the input pixels you are dealing with are special, then the output pixel should be Isis::Null.
- Make sure you account for special pixels in all modes of the application.
Task 6 - Don't duplicate code ¶
- Combine all of the process functions into a single function. Note: This also may take some global variables. Hint: Look at ProcessByLine and other ProcessByXxxxxx
Task 7 - Check your results ¶
- For each mode you have in diff , compare the output to the original Peaks.cub (available from Exercises 1 ) using qview . Make sure your software is processing data correctly.
- Check your special pixels
Task 8 - Remove Global Variables ¶
- As much as possible you want to avoid using global variables. In this exercise you have likely used a global variable to pass information to your line processing function. You should rewrite the program so that it does not rely on global variables. Hint: Look at Isis::ProcessByBrick
Task 9 - Create tests for your new software ¶
- Create tests to ensure your new software is functioning correctly. Unfortunately, mirror 's test data will not do. However, it provides a good example.
- In diff , make sure there is a tsts directory. If is does not exist, use the command make testdir to create it.
- In the tsts directory, make a new test case for one of the modes diff has with the command make newtest TEST=testName . Use a meaningful name.
- Copy the Makefile from mirror 's default test into your new test case directory.
- Modify the Makefile to fully test one of your cases.
- Copy Peaks.cub (available from Exercises 1 ) in the input directory under your test.
- Modify the Makefile to use Peaks.cub as the input.
- Run the command make output . Check the results in the output directory. If they are correct, use make truthdata to save those results to truth directory.
- Repeat the steps above for the other operating modes of diff .
- Now, from the diff directory, try running make test . All of the tests should report OK.
- (In the production system make checkin will copy the truth files into the system's truth file directory. Don't do this step for the tutorial.)
Task 10 - Check code coverage ¶
- We use a program called Squish Coco to check code coverage. This program will generate a report about test coverage in your code.
- Remove built files and make your application and tests with the Test Coverage mode enabled. On the command line, type make clean appname test MODE=TC
- Coco will print you a summary of your coverage. If any of the reports show that your coverage is below 100%, you should check the detailed report and make improvements to ensure your code is thoroughly tested.
- Coco will have made html files in your app directory named functioncoverage.html , linecoverage.html , and scopecoverage.html .
- Explore the features of these detailed reports, find where your code is not covered, and make improvements until the Coco coverage reports are close to 100% coverage.
- Building
- Writing Tests
- Test Data
- Start Contributing
- Public Release Process
- Continuous Integration
- Updating Application Documentation
- Deprecating Functionality
- LTS Release Process and Support
- RFC1 - Documentation Delivery
- RFC2 - ISIS3 Release Policy
- RFC3 - SPICE Modularization
- RFC3 - Impact on Application Users
- RFC4 - Migration of ISIS Data to GitHub - Updated Information 2020-03-16
- RFC5 - Remove old LRO LOLA/GRAIL SPK files
- RFC6 - BLOB Redesign
- Introduction to ISIS
- Locating and Ingesting Image Data
- ISIS Cube Format
- Understanding Bit Types
- Core Base and Multiplier
- Special Pixels
- FAQ