I need to crop a Dicom series and save the result again as a Dicom series, maintaining the information about position. My problem is similar to DICOM File compression but unfortunately all the answers were about compression and not cropping.
An additional problem is that the original series is quite big and I can't load it all in memory on my computer (but I can use a Unix server for computation, if necessary).
I have tried to use ITK: I copied the example DicomSeriesReadSeriesWrite.cxx (described in ITK software guide), using a cropimageFilter before writing. The problem is that using the instruction
seriesWriter->SetMetaDataDictionaryArray(reader->GetMetaDataDictionaryArray() );
in the result the third dimension of image position (0020,0037) is always set to 0. If I comment that instruction, Image position is correct, but Image Number (0020,0013) and SliceLocation (0020,1041) are not, and the result series won't load in some softwares as Osirix.
I've also tried using Dicom2 (http://www.barre.nom.fr/medical/dicom2/ ). Again, the image is cropped fine, but metadata are not consistent (they are just the same as the original image).
I have tried using Amira, but, apart from memory issues, the process of saving the cropped data as dicom ignores the original dicom tags (e.g. image position is [-1.#ND/-1.#ND/-1.#ND], also other tags as "Series Date" change).