Little shift of the image after upgrade from Matlab2011 to Matlab2015.

1 vue (au cours des 30 derniers jours)
Eric Condamine
Eric Condamine le 25 Fév 2016
Hello,
In old scripts, using slice_overlay function (rather than slover function), I observes, after an upgrade from Matlab2011 to Matlab2015, and using the same verison of spm12, a little shift of the image on the final picture.ps. Because this picture.ps is the starting point for other scripts, this little shift makes a very wrong result at the end. I suspect the change in the graphics System, since Matlab2014. I spent a lot of time in trying to find the problem without success ! It is very strange, because the more important parameters (to my knowledge !) are the same with these 2 Matlab version (except the fact that since R2014b, we can use dot notation to query and set properties) :
PaperPosition = [0.0726 0.0644 0.854 0.87]
PaperPositionMode = manual
InvertHardcopy = off
PaperType = A4
PaperSize = [1 1]
PaperOrientation: 'portrait'
PaperUnits: 'normalized'
I think I forgot an other crucial parameter with the new graphics System ? I have no more idea for work around and all help, suggestion will be very apreciate !
Best regards

Réponses (1)

Cam Salzberger
Cam Salzberger le 29 Fév 2016
Hello Eric,
I believe that you are saying that, when a figure showing an image is printed to a PostScript (.ps) file, the image has a small shift, although the properties listed were the same for both versions of MATLAB.
The "slice_overlay" and "slover" functions are third-party tools, so I'm not sure what they do exactly. Does this shift occur even when printing images directly to a PostScript file? Try this code on both versions of MATLAB (uses a built-in image) and see if there is any difference:
load mri
figure
imshow(D(:,:,1),map)
print -dps testimage.ps
If there is a difference, then I would recommend contacting MathWorks Technical Support for further assistance. There may have been some under-the-hood changes to how PostScript files were printed that could be impacting this. For example, there was a change in R2014b which created the files in a different (but valid) way, which Mac Preview did not handle correctly .
If there is no difference, then it is probably an issue either with the figure properties/printing process, or with the "slice_overlay" and/or "slover" functions. Check the 'Renderer' and 'RendererMode' properties of the figure in both versions of MATLAB as well.
I believe that the criteria for "sufficiently complex" images has changed between versions as well, so it could be that one of the files is really a bitmap, despite being in a vector-graphics file. Try forcing the print to use vector-graphics by adding the '-painters' flag to the "print" command.
You could also try using the '-loose' flag in the "print" command as well. This seems to have an affect of the aspect ratio of PostScript (or at least Encapsulated PostScript) files.
Good luck!
-Cam
  1 commentaire
Eric Condamine
Eric Condamine le 1 Mar 2016
Dear Cam,
Thank you very much for your kind detailed answer.
You guess right, and I observed it when printing images directly to a PostScript file. I tried the code
load mri; figure; imshow(D(:,:,1),map); print -dps testimage.ps;
you proposed on both versions of MATLAB (R20011b and R2015b) and, unfortunately, I seen a little shift !!!
Since my first post I changed the scripts to catch in flight the running version of MATLAB in order to change the crop settings of the intermediate images, depending on the version... This dirty fix is effective, and I will follow, as soon as possible, your suggestion by contacting MathWorks Technical Support for further assistance in order to find a more elegant fix.
Thank again for your help.
Eric

Connectez-vous pour commenter.

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by