Emailing JPG images using ClearCanvas external application feature and a bat script.
As per my last post here is a way to email JPG images. I can only get it to do single images at the moment. I have not managed to devise a way to convert and attach multiple images yet. (My bat scripting is a bit rusty)
This is how I did it:
Requirements
- ClearCanvas 2.0 Beta or higher (With External Applications feature)
- Blat Command line emailer - http://www.blat.net/
- dcmj2pnm.exe from DCMTK - http://dicom.offis.de/dcmtk
Steps:
1.) Create folder C:\test\ (Or what ever you want to call it, just update accordingly). Add the dcmj2pnm.exe file to this folder.
2.) Create Bat Script in the folder created above with the following in it:
(Please change the directories, email addresses and server names accordingly)
@ECHO OFF
:PROMPT
cls
echo ClearCanvas Email Script
echo.
echo Please enter recipient email address:
set /p email=
:CONVERT
cls
echo ClearCanvas Email Script
echo.
echo Converting Images to JPG
dcmj2pnm.exe +oj +Wm --scale-x-size 1024 %1 C:\test\%2_.jpg
:SEND
cls
echo ClearCanvas Email Script
echo.
echo Sending Email Message
blat.exe -server servername -f user@domain.com -to %email% -subject "Images - %3" -sensitivity 1 -body "Images Attached" -html -attach "C:\test\%2_.jpg"
:END
pause
3.) Setup the external application as per image below:
There is room for improvement in the script such as error checking etc. But for now it is a nice simple JPG email system a right click away!
Hope this is useful to someone out there.