Export Images to Jpeg format

  • I have been exporting images for sometime now. I have the following in my dicom.ini


    ExportConverters = 2
    ExportConverter0 = mkdcmdir.bat "%V0010,0010"
    ExportConverter1 = dgate.exe "--convert_to_jpg:%f,600,D:\DICOM\Images\%V0010,0010\%b.jpg,//0"


    I have had some images make it to the database but not exported out to the jpeg files. I think that the mkdcmdir.bat is hanging in the queue and then the degate cannot find the directory and then it fails. I was wondering if there is a wait comnmand I could put in between the make directory and the degate so that the server could catch up and the directory will be therem when the degate needs it. Is there such a command and could you tell me what it is. Thank you.

  • Hi,


    try this - run them after each other rather than at the same time:


    Code
    ExportConverters = 1
    ExportConverter0 = mkdcmdir.bat "%V0010,0010"; dgate.exe "--convert_to_jpg:%f,600,D:\DICOM\Images\%V0010,0010\%b.jpg,//0"


    Marcel

  • Hi,


    try this one as a test - the script may not wait until it is done. This command will wait but actually does to much (it stores and loads the image).


    Code
    ExportConverters = 1
    ExportConverter0 = process with mkdcmdir.bat "%V0010,0010"; dgate.exe "--convert_to_jpg:%f,600,D:\DICOM\Images\%V0010,0010\%b.jpg,//0"


    Marcel

  • I would like to get something like this working. When an image comes into conquest, it can convert to .jpg and save it to a directory on the hard drive. I have tried the suggestions above. When the images comes in, the server says
    CONQUESTSRV1] Exportconverter0.0 executes: process with mkdcmdir.bat "VD^LAT^ABDOMEN"
    [CONQUESTSRV1] Exportconverter0.1 executes: dgate.exe "--convert_to_jpg:C:\dicomserver1415\Data\10170-1\1.3.51.0.7.1112797115.37657.62537.39835.11919.53072.3695_0001_000001_12877792270001.dcm,600,C:\DICOM\VD^LAT^ABDOMEN\1.3.51.0.7.1112797115.37657.62537.39835.11919.53072.3695_0001_000001_12877792270001.jpg,//0"
    [CONQUESTSRV1] Server command sent using DGATE -- option


    The C:\DICOM directory never gets an image always empty.


    Any ideas would be appreciated.

  • Hi,


    Try this:


    ImportConverter0 = save jpg to filename.jpg


    or:


    ImportConverter0 = save jpg to %f.jpg


    or


    ImportConverter0 = save jpg frame 0 level 1000 window 300 size 128 to %f.jpg


    or (select frame=10000 + frame rate for animated gif)


    ImportConverter0 = save gif frame 10010 to %f.gif


    save [bmp/gif/jpg]
    level N
    window N
    frame N
    size N
    [to/as] filename


    Marcel

  • I think I am close just need to get it to save the images in a directory with the patient ID or name.


    I have added this to the dicom.ni file.


    Importconverter0=ifequal "%m","CR"; {save jpg to C:\Dicom\%f.jpg;}


    It saves a jpg in the directory with no name and continues to overwirte the .jpg file. Please advise the next step.


    Thanks

  • Thanks for all the help I did get it to work tought I would post it for others if they every needed to save images to jpg as they came into conquest.


    Importconverter0 =ifequal "%m","CR";{save jpg to C:\DICOM\Images\%V0010,0010-%V0020,0013.jpg;}


    This takes every CR image and saves it as a jpg to the directory you choose with the patient name and image number.


    Todd

  • Hello,


    I tried adding the following line to my dicom.ini file:


    Code
    ImportConverter0 = save jpg to H:\MRConverted\JPG\%name\%studydate\%series_%V0008,103e\%V0020,1041[0,5]_%image.jpg


    However, nothing happens when I copy a directory into the console. That is to say, the files get added to the server as usual, but no conversions seem to take place.


    I fear I am missing something basic...

  • Hello, thanks for your quick reply. That works.


    Two other problems:
    1) It seems if I specify a directory that doesn't exist, the file does not get created. Should it be able to create a new directory? I would rather be able to mimic a directory structure that I have the actual DICOMs stored it, but that does not seem to work. I have to dump them all in one folder.


    2) There are specialized phase contrast images (for velocity mapping) that we use that do not get converted properly. They are greyscale images that map velocities in one direction as scales of white and the other direction as scales of black. They show correctly in the built-in browser and Kpacs viewer, but when converted, it appears the mid-grey gets compressed to black and thus any negative velocities (that are encoded as blacker than grey) do not show up properly. Interestingly, IrfanView causes a similar transformation when trying to convert images. It is a bit puzzling because they seem to show up correctly in the browser. Any thoughts on why this is happening? Is a non-standard color pallete being used such that the greyscale gets mapped incorrectly?


    Thanks in advance...

  • Hi,


    1.4.16 has a mkdir command, just create the folder(s) you want to store the images in before attempting to store. Mutiple mkdir of the same folder fail harmlessly.


    The gray value issue is strange. The same code is used in the browser as in save to jpg. You can try adding level and window clauses to the command. I guess the browser adds a size clause to downsize really big images, but I can't imagine that affecting level and window.


    Marcel

  • Actually, I'm wrong. Where the images appear normal is when using the Browse database tab in 1.4.15. It displays incorrectly in 1.4.16rc2 (title banner still says rc1 but I'm sure it is rc2?). Interestingly, it displays correctly in the K-Pacs viewer (ie right click, run K-Pacs viwer) in both 1.4.15 and 1.4.16rc2, so it is not that the image itself is getting modified/corrupted. It is something incorrect in how the new version displays and exports these dcm's.


    Also, this code is what I tried to create the directories. I initially tried to create the directory in one step which didn't work either. No directories get created and no dicoms get exported. If I simply have the images exported to an existing directory (the last commented out line), it works. I don't think there should be any permissions issues preventing the directory creation. Am I using mkdir incorrectly?


  • Hi,


    you correctly create each level of folders, but I believe you may not use a trailing \.


    I will look what goes wrong with the images in browser and to jpg (same code). The k-pacs viewer is different code.


    Marcel

  • Let me know if some sample images would be helpful.


    Removing the trailing \ did not change things.


    After some more testing, it seems that it does not like the name field, 0010,0010, in the directory name. At first I thought it was the karat (^) in the name field that was tripping it up, but I tried truncating the name before the first karat, ie %V0010,0010[0,5], and that still didn't work. If I delete the name field, it works fine.


    Strange because it works fine for me in the FileNameSyntax field, but there I'm using the %name, which I think is not available for the ImportConverter option.


    Any thoughts?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!