/*========================================================================= Program: GDCM (Grassroots DICOM). A DICOM library Copyright (c) 2006-2011 Mathieu Malaterre All rights reserved. See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ /* * Dummy implementation of C.7.1.3 Clinical Trial Subject Module * * Usage: * ClinicalTrialAnnotate gdcmData/012345.002.050.dcm out.dcm */ #include "gdcmReader.h" #include "gdcmWriter.h" #include "gdcmAnonymizer.h" int main(int argc, char *argv[]) { if( argc < 3 ) { std::cerr << argv[0] << " input.dcm output.dcm" << std::endl; return 1; } const char *filename = argv[1]; const char *outfilename = argv[2]; gdcm::Reader reader; reader.SetFileName( filename ); if( !reader.Read() ) { std::cerr << "Could not read: " << filename << std::endl; return 1; } // The output of gdcm::Reader is a gdcm::File //gdcm::File &file = reader.GetFile(); // the dataset is the the set of element we are interested in: //gdcm::DataSet &ds = file.GetDataSet(); gdcm::Anonymizer ano; ano.SetFile( reader.GetFile() ); ano.RemoveGroupLength(); ano.RemovePrivateTags(); // PS 3.3 - 2008 // C.7.1.3 Clinical Trial Subject Module // ano.Replace( gdcm::Tag(0x12,0x10), "BigCompany name" ); // ano.Replace( gdcm::Tag(0x12,0x20), "My Clinical Trial Protocol ID" ); // ano.Replace( gdcm::Tag(0x12,0x21), "My Clinical Trial Protocol Name" ); // ano.Replace( gdcm::Tag(0x12,0x30), "My Clinical Trial Site ID" ); // ano.Replace( gdcm::Tag(0x12,0x31), "My Clinical Trial Site Name" ); // ano.Replace( gdcm::Tag(0x12,0x40), "My Clinical Trial Subject ID" ); // ano.Replace( gdcm::Tag(0x12,0x42), "My Clinical Trial Subject Reading ID" ); gdcm::Writer writer; writer.SetFile( reader.GetFile() ); writer.SetFileName( outfilename ); if( !writer.Write() ) { return 1; } return 0; }