MATLAB Answers

OOP - Sealed Superclasses

27 views (last 30 days)
Peter Cook
Peter Cook on 30 Jan 2018
Commented: Steven Lord on 31 Jan 2018
I am trying to create a custom class to overload the MATLAB image object but am getting this error message:
Class 'matlab.graphics.primitive.Image' is Sealed and may not be used as a superclass
Is there a list of [graphics] objects in The MathWorks documentation which are not "sealed?"
Or should I start from the beginning with
classdef overloadedImage < handle

Accepted Answer

Steven Lord
Steven Lord on 30 Jan 2018
"Is there a list of [graphics] objects in The MathWorks documentation which are not "sealed?" "
No, there is no such list.
"I am trying to create a custom class to overload the MATLAB image object "
Can you say a little more about why you're trying to overload the image object? Perhaps you can already do what you want and you're just not aware of how to do it, or perhaps this could be worthy of an enhancement request?
  2 Comments
Steven Lord
Steven Lord on 31 Jan 2018
Do you need to have your class inherit from the Handle Graphics classes? From my quick reading of your description, I think having an object that contains the image data (the 2-D or 3-D array holding the values that represent the indexed, intensity, or truecolor image) would better suit your needs. That object could have overloaded methods that combine the data and then methods image, imagesc, etc. that call the appropriate Handle Graphics functions on the data stored in your objects.
Alternately, you could simply create functions to perform manipulation of the image data. Much of the functionality in Image Processing Toolbox is done by functions that accept plain numeric or logical arrays. For example, the A input argument for the imtranslate function is the "Image to be translated, specified as a nonsparse, numeric array of any class, except uint64 and int64, or a logical array."
Since you mentioned heatmaps and data gaps, there are a few functions that may be of use to you. First is the heatmap function introduced in release R2017a that can accept a table or timetable. There are functions that work on table arrays and/or timetable arrays to clean missing data. The retime function for timetable arrays may be of particular use for addressing time gaps.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!