I use the DCMTK library (3.6.0) to get the tag value (0020,0013), which is the image number, or slice number in the series.
I use the following in a package script
for /f "tokens=2 delims=[]" %%a in ('@echo. ^|c:\Libs\dcmtk-3.6.0\bin\dcmdump +P "0020,0013" %%i') do (set img_no=%%a)
This is usually good, but sometimes this value is always set to “0” for the entire series.
I tried to reset using this command
C:\Libs\dcmtk-3.6.0\bin>dcmdump +P "0020,0013" PathToInvalideDICOM\img.dcm (0020,0013) IS [0] # 2, 1 InstanceNumber (0020,0013) IS [4] # 2, 1 InstanceNumber (0020,0013) IS [0] # 2, 1 InstanceNumber C:\Libs\dcmtk-3.6.0\bin>dcmdump +P "0020,0013" PathToCorrectDICOM\img.dcm (0020,0013) IS [0] # 2, 1 InstanceNumber (0020,0013) IS [5] # 2, 1 InstanceNumber
As we can see, sometimes the value of get (which is not "0") is the last. In this case, all is well. But in some special cases, the correct value is maintained between two "0".
I also tried using a different dump truck (DCM4CHE 2.0.23) and it gave me the same result.
I want to know why this is happening. And what's more, how to get the right value?
Is there a way in a batch file to eliminate 0 to the desired number?
By default, my last command line takes the last field ... I think.