GDCM 3.2.1

CreateJPIPDataSet.cxx
/*=========================================================================
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.
=========================================================================*/
/*
* This example was created during the GSOC 2011 project for
* JPIP
*/
#include "gdcmAnonymizer.h"
#include "gdcmWriter.h"
#include "gdcmUIDGenerator.h"
#include "gdcmFile.h"
#include "gdcmTag.h"
#include "gdcmSystem.h"
#include "gdcmAttribute.h"
int main(int argc, char *argv[])
{
if( argc < 2 )
{
std::cerr << argv[0] << " output.dcm" << std::endl;
return 1;
}
const char *outfilename = argv[1];
gdcm::Writer w;
gdcm::File &file = w.GetFile();
gdcm::DataSet &ds = file.GetDataSet();
//w.SetCheckFileMetaInformation( true );
w.SetFileName( outfilename );
file.GetHeader().SetDataSetTransferSyntax( gdcm::TransferSyntax::JPIPReferenced );
gdcm::Anonymizer anon;
anon.SetFile( file );
gdcm::MediaStorage ms = gdcm::MediaStorage::SecondaryCaptureImageStorage;
gdcm::UIDGenerator gen;
anon.Replace( gdcm::Tag(0x0008,0x16), ms.GetString() );
std::cout << ms.GetString() << std::endl;
anon.Replace( gdcm::Tag(0x0008,0x18), gen.Generate() );
//
anon.Replace( gdcm::Tag(0x0010,0x10), "JPIP^EXAMPLE" );
anon.Replace( gdcm::Tag(0x0010,0x20), "012345" );
anon.Empty( gdcm::Tag(0x0010,0x30) );
anon.Empty( gdcm::Tag(0x0010,0x40) );
anon.Empty( gdcm::Tag(0x0008,0x20) );
anon.Empty( gdcm::Tag(0x0008,0x30) );
anon.Empty( gdcm::Tag(0x0008,0x90) );
anon.Empty( gdcm::Tag(0x0020,0x10) );
anon.Empty( gdcm::Tag(0x0020,0x11) );
anon.Empty( gdcm::Tag(0x0008,0x50) );
anon.Empty( gdcm::Tag(0x0020,0x0013) );
anon.Replace( gdcm::Tag(0x0020,0xd), gen.Generate() );
anon.Replace( gdcm::Tag(0x0020,0xe), gen.Generate() );
anon.Replace( gdcm::Tag(0x0008,0x64), "WSD " );
anon.Replace( gdcm::Tag(0x0008,0x60), "OT" );
gdcm::Attribute<0x0028,0x7FE0> at;
at.SetValue( "http://dicom.example.com/jpipserver.cgi?target=img.jp2" );
ds.Insert( at.GetAsDataElement() );
// Need to retrieve the PixelFormat information from the given file
if (!w.Write() )
{
std::cerr << "Could not write: " << outfilename << std::endl;
return 1;
}
return 0;
}
gdcm::Anonymizer
Anonymizer.
Definition gdcmAnonymizer.h:78
gdcm::Anonymizer::SetFile
void SetFile(const File &f)
Set/Get File.
Definition gdcmAnonymizer.h:126
gdcm::Anonymizer::Empty
bool Empty(Tag const &t)
Make Tag t empty (if not found tag will be created)
gdcm::Anonymizer::Replace
bool Replace(Tag const &t, const char *value)
gdcm::Attribute
Attribute class This class use template metaprograming tricks to let the user know when the template ...
Definition gdcmAttribute.h:86
gdcm::Attribute::SetValue
void SetValue(ArrayType v, unsigned int idx=0)
Definition gdcmAttribute.h:169
gdcm::Attribute::GetAsDataElement
DataElement GetAsDataElement() const
Definition gdcmAttribute.h:183
gdcm::DataSet
Class to represent a Data Set (which contains Data Elements)
Definition gdcmDataSet.h:56
gdcm::DataSet::Insert
void Insert(const DataElement &de)
Definition gdcmDataSet.h:128
gdcm::FileMetaInformation::SetDataSetTransferSyntax
void SetDataSetTransferSyntax(const TransferSyntax &ts)
gdcm::File
a DICOM File
Definition gdcmFile.h:34
gdcm::File::GetDataSet
const DataSet & GetDataSet() const
Get Data Set.
Definition gdcmFile.h:57
gdcm::File::GetHeader
const FileMetaInformation & GetHeader() const
Get File Meta Information.
Definition gdcmFile.h:48
gdcm::MediaStorage
MediaStorage.
Definition gdcmMediaStorage.h:44
gdcm::MediaStorage::SecondaryCaptureImageStorage
@ SecondaryCaptureImageStorage
Definition gdcmMediaStorage.h:65
gdcm::MediaStorage::GetString
const char * GetString() const
Return the Media String of the object.
gdcm::Tag
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
gdcm::TransferSyntax::JPIPReferenced
@ JPIPReferenced
Definition gdcmTransferSyntax.h:85
gdcm::UIDGenerator
Class for generating unique UID.
Definition gdcmUIDGenerator.h:28
gdcm::UIDGenerator::Generate
const char * Generate()
gdcm::Writer
Writer ala DOM (Document Object Model)
Definition gdcmWriter.h:49
gdcm::Writer::GetFile
File & GetFile()
Definition gdcmWriter.h:67
gdcm::Writer::Write
virtual bool Write()
Main function to tell the writer to write.
gdcm::Writer::SetFileName
void SetFileName(const char *filename_native)
Set the filename of DICOM file to write:
gdcmAnonymizer.h
gdcmAttribute.h
gdcmFile.h
gdcmSystem.h
gdcmTag.h
gdcmUIDGenerator.h
gdcmWriter.h