I am trying generate a dicom series from volume data.
How can should i give the patient position tag ,orientation tag and pixel spacing tag for each slice? Should I add them in a loop?
I could not find any examples for this. If any reference is there, it will be helpful.
As you haven’t specified if you are using SimpleITK or ITK, I’ll assume SimpleITK and point you to this example of writing a DICOM series from array. Hopefully this is what you are looking for. If not, please provide additional details.
How about this example? If you are not starting from a DICOM input, I think you need to “invent” a patient and a study in order to write a DICOM series.
If you don’t need a series, can you try using a regular ITK writer and asking for a file name which ends with .dcm? Or explicitly setting GDCMImageIO on the writer?
I am not starting from a dicom series.
If I use regular image series writer with filename ending with .dcm, the patient position and orientation tags are not updating. Anyways I am working using the reference you gave.