Okie.. Can you guide me under which section i will find this.As, yesterday i had gone through the whole manual and find some new things.
Storage on Basis on Institution Name
-
-
Here,
here is an example post about this option:
http://forum.image-systems.biz…c.php?f=33&t=18767#p28628
Marcel
-
Hi
I had created a new column HOSPCODE in database table name DICOMSTUDIES. Now i want to set the value of HOSPCODE on the basis of Hospital Name. My entry in dicom.ini file is as below:-
[lua]
global = print ('hello world');ImportConverter0 = if Data.InstitutionName == 'ABC Children Hospital' then Data.Storage='MAG2' and set HCODE to "ABCCH" and Data.Modality == 'CT' then Data:Compress('jk') end;
or i should write each separate importconvertor like this.
[lua]
global = print ('hello world');ImportConverter0 = if Data.InstitutionName == 'ABC Children Hospital' then Data.Storage='MAG2' end;
ImportConvertor1 = if Data.InstitutionName == 'ABC Children Hospital' then set HCODE to "ABCCH" end;
ImportConvertor2 = if Data.InstitutionName == 'ABC Children Hospital' and Data.Modality == 'CT' then Data:Compress('jk') end;In this way i uses 3 Importconvertors to perform the same task and i want to avoid this due to the limitation of Importconvertor (i.e Importconvertor 1 to 99). Please guide me how can i use nested IF statements in lua.
-
Hi,
you have the full Lua language at your disposal. So maybe the easiest solution is to call an external Lua script file with e.g.
[lua]
importconverter0 = dofile('hammad.lua')and write out the if statements as such (untested):
file hammad.lua
You can put the whole code in dicom.ini but than it needs to be on one line. To debug the lot put in print statements.
Marcel
-
Thanks Marcel.... I will test and update you..
-
Hi,
I just realized that the sql statement may not work: the study may not yet exist (this happens after the importconverter). It would work on the second image. Maybe better to add a private tag (e.g. Data["0009,1234"]="ABCCH") and also define e.g. 0009,1234 in the database through dicom.sql (do not put it first or last).
Marcel
-
Is this correct ???
in dicom.sql
{ 0x0009, 0x1234, "HOSPID", 10, SQL_C_CHAR, DT_STR },hammad.lua file
iif Data.InstitutionName == 'ABC Hospital' then
Data.Storage='MAG2'print('------ testing an SQL statement --------')
print ('Hospital Name is :'..Data.InstitutionName);
print ('Study Instance Saved is :'..Data.StudyInstanceUID);
print ('*****************************************************');
print ('**********Start of Sql Statement***********************');
print ('******************************************************');
sql("UPDATE DICOMSTUDIES SET HOSPID= 'ABCH' where dicomstudies.StudyInsta='Data.StudyInstanceUID'");
print ('******************SUCCESS************************************');
--sql(format("UPDATE dicomstudies SET Data['0009,1234']='ABCCH' where dicomstudies.StudyInsta='%s', Data.StudyInstanceUID));end
Records are not updated and I get no errors but as all statements are executed. Please guide me.
--HM -
Hi,
Below is the exact correct form of the statement (not using your HOSPID column because I don't have it, and passing the studyinstanceuid of the conquest sample image).
It returns 1, meaning success. If it fails it returns nil. To have this working, the record in the database should already exist, so it will only work on the second image entered.
regards,
Marcel
-
I test your statement it returns 1 as per your comment. But how can i update it as you said that importconvertor will work after second image???
Please guide
-
You can add a private tag in your dicom image (as I said in the post before), e.g.:
Data["0009,1234"]="ABCCH"
This will then automatically be written in the database if the tag is defined in dicom.sql.
Note that if you change dicom.sql you have to regenerate the whole database, be careful.
Marcel
-
i had added the private tag that you mentioned in dicom.sql and regenerate the database. Now this new filed with name HID is created in database. Now how can i set this field value?
-
Hi
By using the importconverter to add the same tag to each image.
Marcel
-
Okie and how to add that newly created tag in each image (sorry because of lack of knowledge regarding conquest in detail working)...
-
Like this:
ImportConverter0 = set xxxx,xxxx to "ABCCH" -
Or in the lua script - as I stated in one of my previous posts:
Data["0009,1234"]="ABCCH"
Marcel
-
Thanks Marcel for your help and patience. That worked fine. I got it done via lua scripting.
--HM
-
Hi Marcel
Is it possible that i bound certain AETs of any hospital to query specific MAG or MAGs...
--HM
-
Difficult!
MAGs are set at the image level, so queries at higher levels have no access.
Marcel
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!