isequal
(To be removed) Compare two bigimage
objects for
equality
The isequal
function of the bigimage
object will be
removed in a future release. Use the blockedImage
object
instead. For more information, see Version History.
Description
returns tf
= isequal(bigimg1
,bigimg2
)true
if big images bigimg1
and
bigimg2
have the same spatial referencing, underlying data type, and
block size. Pixel values are only compared if the metadata is equal, and the comparison ends
early when unequal pixel values are found. isequal
does not consider file
names, masks, and other class properties.
Input Arguments
Output Arguments
Version History
Introduced in R2019bR2024b: Warns
The isequal
function issues a warning that it will be removed
in a future release.
R2023b: To be removed
The bigimage
object and this function will be removed in a future
release. Use blockedImage
objects instead. You can compare the equality of two blockedImage
objects
using the isequal
function that ships in MATLAB®.
The functions can return different results because they compare different properties of
the objects. The bigimage
isequal
function does not consider file names, masks, and other class
properties when evaluating the equality of two bigimage
objects. In
contrast, the MATLAB
isequal
function considers all object properties when evaluating the
equality of objects, including the image filenames. Therefore, the MATLAB
isequal
function determines that blockedImage
objects
are not equal in more situations than the bigimage
isequal
function.
To update your code, first create two blockedImage
objects to read your
image data. If you want to reproduce the behavior of the bigimage
object,
then follow these steps:
Compare the equality of the relevant properties, such as the
Channels
,ClassUnderlying
, andBlockSize
properties. Although theblockedImage
object does not have aSpatialReferencing
property, you can compare related properties such asWorldStart
andWorldEnd
.If any of these properties are not equal between the two objects, then the objects are not equal.
If all of these properties are equal between the two objects, then you can compare the data at each resolution level. Read the data using
blockedImageDatastore
objects, and determine the data equality using the MATLABisequal
function. To perform the comparison efficiently, start by comparing data at the coarsest resolution level and then compare data at increasingly fine resolution levels.If any block of read data is not equal between the two objects, then the objects are not equal. Otherwise, the objects are equal.
Discouraged Usage | Recommended Replacement |
---|---|
This example uses the
filename = "tumor_091R.tif";
bim1 = bigimage(filename,BlockSize=[100 100]);
bim2 = bigimage(filename,BlockSize=[200 200]);
tf = isequal(bim1,bim2); | Here is approximately equivalent code comparing two
filename = "tumor_091R.tif";
bim1 = blockedImage(filename,BlockSize=[100 100]);
bim2 = blockedImage(filename,BlockSize=[200 200]);
tf = isequal(bim1,bim2); |
Here is approximately equivalent code comparing two
First, compare properties of
the filename = "tumor_091R.tif"; bim1 = blockedImage(filename,BlockSize=[100 100]); bim2 = blockedImage(filename,BlockSize=[200 200]); tf = isequal(bim1.WorldStart,bim2.WorldStart) ... && isequal(bim1.WorldEnd,bim2.WorldEnd) ... && isequal(bim1.Size,bim2.Size) ... && isequal(bim1.NumLevels,bim2.NumLevels) ... && isequal(bim1.Channels,bim2.Channels) ... && isequal(bim1.ClassUnderlying,bim2.ClassUnderlying) ... && isequal(bim1.BlockSize,bim2.BlockSize); If these properties are equal, then you can compare the data for each resolution level. for lvl = bim1.NumLevels:-1:1 ds1 = blockedImageDatastore(bim1,lvl); ds2 = blockedImageDatastore(bim2,lvl); while tf && hasdata(ds1) && hasdata(ds2) tf = isequal(read(ds1),read(ds2)); end end If |
R2021a: isequal
function is not recommended
The isequal
function of the bigimage
object is not
recommended. Use a blockedImage
object instead. The
blockedImage
object offers several advantages including extension to N-D
processing, a simpler interface, and custom support for reading and writing nonstandard image
formats.
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)