Steve on Image Processing

March 19th, 2009

MTEST update, plus Help Browser integration info

Earlier this week I posted an update to my MTEST unit test framework on the File Exchange. I wasn't completely happy with my assertion function for comparing floating-point numbers using a tolerance, so I added two new ones: assertElementsAlmostEqual and assertVectorsAlmostEqual. I also fixed a problem with the way mtest was scanning the current directory in order to find test files.

Last week someone asked me about integrating the MTEST doc in the MATLAB Help Browser, so I looked into that. It is possible, as it turns out. There's a detailed explanation of how to do that in the MATLAB Helper Browser documentation. See the section on Adding HTML Help Files for Your Own Toolbox. Using this explanation, I was able to have the MTEST documentation appear in the Help Browser. If you distribute your own MATLAB code for others you use, you might want to give this a try.

4 Responses to “MTEST update, plus Help Browser integration info”

  1. James Ong replied on :

    Is is just me, or has AssertAlmostEqual disappeared from the main documentation of mtest?

  2. Steve replied on :

    James—Yes, assertAlmostEqual has disappeared from the main documentation. That was intentional. The explanation is in the first paragraph of this post. I have the new floating-point comparison functions assertElementsAlmostEqual and assertVectorsAlmostEqual. I left assertAlmostEqual there to avoid making an incompatible change, but I would prefer that people use the new functions.

  3. James Ong replied on :

    Ah, then I’ll change my test functions to not use assertAlmostEqual any more.

    By the way, your post on MTEST and refactoring made me read through the books “Test-driven development” (Beck) and “Refactoring” (Fowler) plus try programming MATLAB in an object oriented way. I’m still assessing the advantages and disadvantages for my work, but the most obvious at the moment are:
    - the code is more robust than I’m used to
    - the development time is somewhat slower than I’m used to

  4. Steve replied on :

    James—That’s a lot of changes to try all at once! Test-driven development and object-oriented programming both take some getting used to. Some programmers find that development pace actually speeds up with test-driven development, because the fraction of time spent debugging goes way down. But that’s only after you have some experience with the technique, and only if you get in the habit of making code changes in small, rapid increments.

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


Steve Eddins manages the Image & Geospatial development team at The MathWorks and coauthored Digital Image Processing Using MATLAB. He writes here about image processing concepts, algorithm implementations, and MATLAB.

  • Sana: hi steve, could you explain to me how i would be able to use the dir function, to do a loop through a directory...
  • Nishtha: Sir, I have preprocessed the image in following steps: [1] adaptive histogram equalization [2] thresholding...
  • Kristof: I also strongly support the idea. I have just recently bumped into the problem that im2single was not...
  • Steve: David—I’ m glad you found it useful!
  • David Lalejini: I found your example very useful for finding connected nodes in a large set of input pairs. I start...
  • tommy: Dear Steve, I have a question,please if you are kind to help me regarding the accumulator array dimensions of...
  • Steve: Abc—I don’t know how to distinguish the faces. You might try posting your question in the MATLAB...
  • Manju: well if we have a few ovals within each other like in a cell how do we measure the distance from the center...
  • Steve: Manju—What do you mean? How is each region defined?
  • Manju: if we have 2-3 regions within each other how do we measure the regions of each one?

These postings are the author's and don't necessarily represent the opinions of The MathWorks.