BookmarkSubscribeRSS Feed
xxformat_com
Barite | Level 11

Hi, Do you know if in a future SAS release, it will be possible to list differences between two images.

In clinical trial, it is common to receive several versions of the deliverables, including graphs. Therefore, it would be useful to be able to review changes.

Here is a paper on some R packages on comparing images (pages 6 and 7): https://www.lexjansen.com/pharmasug/2022/AD/PharmaSUG-2022-AD-076.pdf

Cheers

4 REPLIES 4
sbxkoenk
SAS Super FREQ

It's of course much (MUCH!) easier to PROC COMPARE the data behind the images ,

 

... but here is a possibility :

 

SAS Visual Data Mining and Machine Learning Programming Guide
Image Action Set
The compareImages Action
https://go.documentation.sas.com/doc/en/pgmsascdc/v_031/casactml/casactml_image_examples43.htm

 

Koen

 
Ksharp
Super User
Maybe you should resort to Jmp or SAS Viya ?
Post your question at Jmp forum ,maybe you could get answer .
https://community.jmp.com/
ErikLund_Jensen
Rhodochrosite | Level 12

Hi @xxformat_com 

 

You don't tell how your pictures are stored. If they are stored as files, you could generate a checksum for each file and compare the checksums. I don't know for sure if a sha256 checksum is truly unique, but I suppose it would be sufficient in this case. I haven't used it on pictures, only program code, ODBCINI files and similar, where is does a goos job, but as the checksum algorith isn't linked to certain file types, it should work on pictures as well. I tested it with a jpg-file.

 

I use the following small macro on a Linux system, and I think there must be something similar available on Windows. The macro should be self-explaining, but I will be happy to explain further.

 

/***************************************************************************/
/* getchecksum                                             erlu 2021-01-16 */
/*                                                                         */
/* creates sha256-checksum for files.                                      */
/* Makroen takes an input dataset with file names and creates an           */
/* output dataset from input with added column checksum                    */
/* Arguments:                                                              */
/*    dsin         Input dataset with file names.                          */
/*    pathcol      Name of input column containing file name (full path).  */
/*    dsout        Name to be assigned to output dataset.                  */
/***************************************************************************/

%macro getchecksum(dsin,pathcol,dsout);
	data &dsout;
		set &dsin (keep=path);
		length checksum $128;
		pipecmd ='sha256sum "' || trim(path) || '"';
		infile dummy pipe filevar = pipecmd;
		input;
		checksum = scan(_infile_,1,' ');
	run;
%mend;

If your pictures are stored as variables i a SAS dataset, which I think is unlikely because of the 32k limit, you can use the sha256 SAS function instead.

 

 

 

sbxkoenk
SAS Super FREQ

Following up on the post by @ErikLund_Jensen 

, find here a bit more info on calculating checksums with SAS.

 

Checksums and data integrity in SAS programs
By Rick Wicklin on The DO Loop October 5, 2022
https://blogs.sas.com/content/iml/2022/10/05/checksums-sas.html

 

Koen

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 653 views
  • 4 likes
  • 4 in conversation