Hi
I want to get the month of the Study from StudyDate column using following lua command but it gives the wrong answer. Instead of March, it is showing August.
local result = os.date("%m/%d/%y",20210317)
Please guide.
Hi
I want to get the month of the Study from StudyDate column using following lua command but it gives the wrong answer. Instead of March, it is showing August.
local result = os.date("%m/%d/%y",20210317)
Please guide.
Hi,
this is a generic lua question, I would look it up too!. The input to os.date is seconds since 1/1/1970. Dicom date is in a string yyyymmdd so you use substrings to split year month and day and then combine them as you wish.
Marcel
Hi
Thanks for your guidance. Some how i manage it. But i am facing error:: How to assign value to new DICOM tag. I am using this " Data["9999,9002"]= Studymonth. But no value is set.
and correct this also
FileNameSyntax = %modality\%v9999,9002\
Can i get the Study Size and populate its value in a column STUDYSIZE....
Please guide.
Hi,
Can you use the browser window modify - modify image (advanced) - you can enter your lua code there and then push "test syntax". The messagebox shows the output, e.g. this works:
Data["9999,9002"]="test"
print(Data["9999,9002"])
Because the message box says "test"
By the way you probably want this, no lua required:
FileNameSyntax = %studydate[0,3]\%studydate[4,5]\%studydate[6,7]\%id\%studyuid\%seriesuid\%sopuid.dcm
Marcel
my lua script is as follow:-
local StudyDate = Data.StudyDate
year = StudyDate:sub(0,4)
month = StudyDate:sub(5,6)
day = StudyDate:sub(7,8)
Data["9999,9002"]= month
print(Data["9999,9002"])
It prints UKNOWN.
i want the value of month assign to Data["9999,9002"]
It works for me. Prints "04" on a sample image.
Marcel
lua script
The else only works on the last if!
e.g. you must use:
if studymonth=='01' then studymonth="January"
--
elseif studymonth=='10' then studymonth="October"
elseif studymonth=='11' then studymonth="November"
elseif studymonth=='12' then studymonth="December"
else studymonth="Unknown" end
Thanks its working now.
For File Syntax
FileNameSyntax = %modality\\%StudyYear/%StudyMonth\%studydate[6,7]-%studydate[4,5]-%studydate[0,3]\%id-(%name)\%VSeriesDescription\%series%counter.dcm
or shpuld i use this
FileNameSyntax = %modality\%V9999,9001\%V9999,9002\%studydate[6,7]-%studydate[4,5]-%studydate[0,3]\%id-(%name)\%VSeriesDescription\%series%counter.dcm
PLease guide
Hi,
if you are on Windows you use \ to create folders (not \\ and not /). For the rest you are free to do as you like.
Try it on a test server.
Marcel
Can i read the newly created dicom tag and use that in Filename syntax.
As Study Year and Study Month is not created....
Good question.
I think the scripts are run before the filename is generated. However, no new filename is ever created for objects already stored in the server. You have to delete e.g. the patient to see new filenames being created.
Marcel
I am using the scripts in ImportConvertor and also tested with an empty database.
Are the dicom tags stored in the images?
Marcel
Yes..
I am saving the year and month info in dicomstudies table not in dicomimsges
Hi,
I am asking whether they are actually stored in the images. That is where Data[] goes. And Filenamesyntax takes them from there.
Marcel
Marcel its working now. After sudden restart of server. Its working now.
THANKS FOR YOUR SUPPORT.
Super!
Marcel
Don’t have an account yet? Register yourself now and be a part of our community!