RTPlan Update Dicom TAG

  • Hello All ,marcelvanherk

    I am trying to update Database , dicom.sql and dicom.ini to save all radiation plan data in Sql server database all field are Null except Gantry and Collimator angle .



    dicom.ini

    ExportConverters = 1

    ExportConverter0 = ifequal "%modality", "RTPLAN"; modifyobject "%(300A,00C3)" "%BeamName"; modifyobject "%(300A,0114)" "%Energy"; modifyobject "%(300A,011C)" "%LeafJawPositions";


    Please any help

  • Hi, a radiation plan is an array of control points, that contain e.g. many gantry angles, leaf positions etc. So it is not possible to store these in a single database field. I also do not know what "modifyobject" means. And anyway anything in an exportconnverter runs after the image is stored in the database.


    Marcel

  • Hi,


    you can use Lua to read it, e.g. by starting a script for each received item:


    ImportConverter0 = lua/yourfile.lua


    And then e.g. there (this is for an RTSTRUCT, princliple is the same for an RTPLAN:


    if Data.Modality=='RTSTRUCT' then

    for i=0, #Data.StructureSetROISequence-1 do

    print('*** frameofref', i, Data.StructureSetROISequence[i].ReferencedFrameOfReferenceUID)

    end;

    for i=0, #Data.ROIContourSequence-1 do

    for j=0, #Data.ROIContourSequence[i].ContourSequence-1 do

    for k=0, #Data.ROIContourSequence[i].ContourSequence[j].ContourImageSequence-1 do

    print('*** r sop', i, j, k, Data.ROIContourSequence[i].ContourSequence[j].ContourImageSequence[k].ReferencedSOPInstanceUID)

    end

    end

    end

    end



    Marcel

  • Dear Mr.Marcel

    thank you so much for your help your example code its working for save gantry and collimator only

    i am tray to save MU,Energy ,X,Y ,MLC etc.. from RTPlan by this code For Dose Details



    Please for your help .


  • Hi,

    still all value are Null except Gantry and Collimator angle

    i try more time by RtPaln ,RtIMAGE but still not working


    any way thank you for your help .


  • BeamLimitingDeviceSequenc --> BeamLimitingDeviceSequence

    ReferencedStructureSequenc -.> ReferencedStructureSequence

    FractionGroupSequenc --> FractionGroupSequenc


    Then the code may run. It should print info from the RTPLAN to the server's log window when it recieves one. The attached script shows an example script modifying tags in an rtlan. Use with care


    Marcel

    Files

    • FixRTDicom.zip

      (2.2 kB, downloaded 29 times, last: )

    Marcel van Herk is developer of the Conquest DICOM server together with Lambert Zijp.

  • Hi

    Marcel


    Please check for this Code

    thank you

    [LINACDATA] ***Exportconverter0: Spawning 'lua\UpdateImage.lua' failed (argv=e:\dicomserver150e\data\524070\1.3.6.1.4.1.2452.6.1535943060.1322677368.330235017.3277645119_0001_000000_1742057454000d.dcm)

  • ImportConverter0 = lua/yourfile.lua


    use a / not a \


    In your code line 10 misses a .


    A simple way to test this code is in the GUI - modify image (advanced)



    This is the correct syntax:



    Or install zerobrane studio and link it to conquest (see manual)


    Marcel

  • Dear Marcel

    the code is working in Conquest Server but in Database all value are Null





    PACSDB] Processing RTImage for patient Name

    [PACSDB] FieldSizeX i is 0and j is 0 is -90.00\0.00

    [PACSDB] FieldSizeY 0and 0 is -90.00\0.00

    [PACSDB] FieldSizeX i is 0and j is 1 is -80.00\80.00

    [PACSDB] FieldSizeY 0and 1 is -80.00\80.00

    [PACSDB] ***Truncated PatientPos from 56 to 16 chars in file: 535637\1.3.6.1.4.1.2452.6.928084557.1258562412.3879072164.17834433_0001_000002_174219170000be.dcm

    [PACSDB] Written file: D:\dicomserver150\Data\535637\1.3.6.1.4.1.2452.6.928084557.1258562412.3879072164.17834433_0001_000002_174219170000be.dcm

    [PACSDB] Processing RTImage for patient Name AMAT ALRAHEEM SALEH SALEH ALSMAI^^^^ PatientID=535637

    [PACSDB] FieldSizeX i is 0and j is 0 is -100.00\0.00

    [PACSDB] FieldSizeY 0and 0 is -100.00\0.00

    [PACSDB] FieldSizeX i is 0and j is 1 is -67.50\67.50

    [PACSDB] FieldSizeY 0and 1 is -67.50\67.50

    [PACSDB] ***Truncated PatientPos from 56 to 16 chars in file: 535637\1.3.6.1.4.1.2452.6.928084557.1258562412.3879072164.17834433_0001_000001_174219170000bf.dcm

    [PACSDB] Written file: D:\dicomserver150\Data\535637\1.3.6.1.4.1.2452.6.928084557.1258562412.3879072164.17834433_0001_000001_174219170000bf.dcm

    [PACSDB] Processing RTImage for patient Name

    [PACSDB] FieldSizeX i is 0and j is 0 is 0.00\90.00

    [PACSDB] FieldSizeY 0and 0 is 0.00\90.00

    [PACSDB] FieldSizeX i is 0and j is 1 is -80.00\80.00

    [PACSDB] FieldSizeY 0and 1 is -80.00\80.00




    thanks

  • Ok,


    the sql database automatically stores any non-sequence item that is listed in dicom.sql. You can maybe sort your problem by using lua to create private elements to the RTPLAN object and define these in dicom.sql so that they are written. However, as I pointed out there can be hundreds of control points so I am not sure how you would code that in a single text string. I think database fields in conquest are limited to 256 characters.


    A better solution is to create a database table yourself (you can use lua to do this) and use lua sql() command to write into that and dbquery() to read.


    console.bat runs a simple console where you can try any lua code. It stores the history of what you typed.


    A bit of example code (from overview.lua in the distribution, it has examples for all lua functions):


    sql("CREATE TABLE UserTable (CounterID varchar(99), Val integer)");

    sql("INSERT INTO UserTable (CounterID,Val) VALUES ('CT',1) ON DUPLICATE KEY UPDATE Val=Val+1");


    Marcel

Participate now!

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