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 R2019bThe isequal function issues a warning that it will be removed
in a future release.
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, andBlockSizeproperties. Although theblockedImageobject does not have aSpatialReferencingproperty, you can compare related properties such asWorldStartandWorldEnd.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
blockedImageDatastoreobjects, and determine the data equality using the MATLABisequalfunction. 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 |
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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)