- 
                Notifications
    
You must be signed in to change notification settings  - Fork 34
 
Description
When loading in a pixel mask while mixing imports using the "GSAS-II known TIF image" and standard TIF import, I get the following error:
Mask dimensions ((2048, 2048)) != Image (4194304). Images do not match
Both images are TIF files of the same shape. The data file is loaded in using the GSAS-II known TIF import option, and the pixel mask is loaded in with the standard TIF option.
If both the data file and the mask file are imported as standard TIF files, the mask is applied correctly and no error is given. This error only occurs when mixing the two import options.
If I ravel the mask image before saving it, the error changes to the following:
Mask dimensions ((4194304, 1)) != Image (4194304). Images do not match
I have tried saving using tifffile, skimage.io, and PIL.Image in case this is related to the exact method in which it is saved; all three export options have led to one of the above errors (so long as the two import types are mixed).
The standard TIF reader continues to read in the image as a higher-dimensional array while the manual read from the GSAS-II known TIF import treats it as 1-dimensional and therefore of a different shape.
In the shape check when applying a pixel mask, could you modify the check such that the flattened arrays are the same size? It feels a bit unsafe to suggest this - there could be a problem with ordering the axes properly, etc. - but there would at least be a clear visual indicator of whether the mask was applied properly.
Here is the data image file I have used for testing:
MA2-00001.tif
The metadata file has been renamed to .txt so that github allows it to be uploaded:
MA2-00001.tif.metadata.txt
Here is the test mask:
test_mask.tif