Program: gdcm
Module: $RCSfile: Anonymize.cxx,v $
Language: C++
- Date: $Date: 2005/08/30 15:13:05 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2005/10/25 14:52:26 $
+ Version: $Revision: 1.6 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
gdcm::File *f;
- f = new gdcm::File( );
+ f = gdcm::File::New( );
f->SetLoadMode( gdcm::LD_ALL );
f->SetFileName( fileName );
int res = f->Load();
{
std::cerr << "Sorry, " << fileName <<" not a gdcm-readable "
<< "DICOM / ACR File" <<std::endl;
- delete f;
+ f->Delete();
return 0;
}
std::cout << " ... is readable " << std::endl;
// ============================================================
// We need a gdcm::FileHelper, since we want to load the pixels
- gdcm::FileHelper *fh = new gdcm::FileHelper(f);
+ gdcm::FileHelper *fh = gdcm::FileHelper::New(f);
// (unit8_t DOESN'T mean it's mandatory for the image to be a 8 bits one)
std::cerr << "Sorry, Pixels of" << fileName <<" are not "
<< " gdcm-readable." << std::endl
<< "Use exAnonymizeNoLoad" << std::endl;
- delete f;
- delete fh;
+ f->Delete();
+ fh->Delete();
return 0;
}
// ============================================================
f->ClearAnonymizeList();
- delete f;
- delete fh;
+ f->Delete();
+ fh->Delete();
return 0;
}
Program: gdcm
Module: $RCSfile: AnonymizeDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:43 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2005/10/25 14:52:26 $
+ Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// Read the input DICOMDIR
gdcm::File *f;
- f = new gdcm::File( );
+ f = gdcm::File::New( );
f->SetLoadMode(0);
f->SetFileName( fileName );
bool res = f->Load();
if ( !e )
{
std::cout << "No Directory Record Sequence (0004,1220) found" <<std::endl;;
- delete f;
+ f->Delete();
return 0;
}
if ( !s )
{
std::cout << "Element (0004,1220) is not a Sequence ?!?" <<std::endl;
- delete f;
+ f->Delete();
return 0;
}
fp->close();
- delete f;
+ delete fp;
+ f->Delete();
return 0;
}
Program: gdcm
Module: $RCSfile: AnonymizeNoLoad.cxx,v $
Language: C++
- Date: $Date: 2005/08/30 15:13:05 $
- Version: $Revision: 1.12 $
+ Date: $Date: 2005/10/25 14:52:26 $
+ Version: $Revision: 1.13 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//
// Parse the input file.
//
- f = new gdcm::File( );
+ f = gdcm::File::New( );
f->SetLoadMode(loadMode);
f->SetFileName( fileName );
<< "Sorry, " << fileName <<" not a gdcm-readable "
<< "DICOM / ACR Document"
<< std::endl;
- delete f;
+ f->Delete();
return 1;
}
std::cout << fileName << " is readable " << std::endl;
//
f->ClearAnonymizeList();
- delete f;
+ f->Delete();
return 0;
}
it != fileList.end();
++it )
{
- f = new gdcm::File( );
+ f = gdcm::File::New( );
f->SetLoadMode(loadMode);
f->SetFileName( it->c_str() );
if ( !f->Load() )
{
- delete f;
+ f->Delete();
continue;
}
//
f->ClearAnonymizeList();
- delete f;
- }
-
- }
+ f->Delete();
+ }
+ }
return 0;
}
Program: gdcm
Module: $RCSfile: FindTags.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:43 $
- Version: $Revision: 1.15 $
+ Date: $Date: 2005/10/25 14:52:26 $
+ Version: $Revision: 1.16 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
std::string fileName;
gdcm::FileHelper *h;
- gdcm::File *f = new gdcm::File();
+ gdcm::File *f = gdcm::File::New();
if(argc > 1 )
f->Load();
// Should test if it worked !
- h = new gdcm::FileHelper(f);
+ h = gdcm::FileHelper::New(f);
std::string ManufacturerName="SIEMENS ";
std::string RecCode="ACR-NEMA 2.0";
std::cout << "----------------apres Write---------------------" << std::endl;
+ h->Delete();
+ f->Delete();
+
return 0;
}
Program: gdcm
Module: $RCSfile: MakeDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/08/31 09:29:10 $
- Version: $Revision: 1.15 $
+ Date: $Date: 2005/10/25 14:52:26 $
+ Version: $Revision: 1.16 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// we ask for Directory parsing
- dcmdir = new gdcm::DicomDir( );
+ dcmdir = gdcm::DicomDir::New( );
dcmdir->SetStartMethod(StartMethod);
dcmdir->SetEndMethod(EndMethod);
{
std::cout << "makeDicomDir: no patient found. Exiting."
<< std::endl;
- delete dcmdir;
+ dcmdir->Delete();
return 1;
}
// ----- Create the corresponding DicomDir
dcmdir->Write("NewDICOMDIR");
- delete dcmdir;
+ dcmdir->Delete();
// Read from disc the just written DicomDir
- gdcm::DicomDir *newDicomDir = new gdcm::DicomDir();
+ gdcm::DicomDir *newDicomDir = gdcm::DicomDir::New();
newDicomDir->SetFileName( "NewDICOMDIR" );
newDicomDir->Load();
if( !newDicomDir->IsReadable() )
<<" is not readable"<<std::endl
<<" ...Failed"<<std::endl;
- delete newDicomDir;
+ newDicomDir->Delete();
return 1;
}
<<" has no patient"<<std::endl
<<" ...Failed"<<std::endl;
- delete newDicomDir;
+ newDicomDir->Delete();
return(1);
}
std::cout<<std::flush;
- delete newDicomDir;
+ newDicomDir->Delete();
return 0;
}
Program: gdcm
Module: $RCSfile: PatchHeader.cxx,v $
Language: C++
- Date: $Date: 2005/08/30 15:13:05 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2005/10/25 14:52:27 $
+ Version: $Revision: 1.5 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
loadMode |= gdcm::LD_NOSHADOWSEQ;
else
{
- if ( am->ArgMgrDefined("noshadow") )
+ if ( am->ArgMgrDefined("noshadow") )
loadMode |= gdcm::LD_NOSHADOW;
if ( am->ArgMgrDefined("noseq") )
loadMode |= gdcm::LD_NOSEQ;
if ( fileName != 0 ) // ====== Deal with a single file ======
{
-
- //
- // Parse the input file.
- //
-
- f = new gdcm::File( );
+ //
+ // Parse the input file.
+ //
+ f = gdcm::File::New( );
f->SetLoadMode(loadMode);
f->SetFileName( fileName );
bool res = f->Load();
// not only gdcm::File (as opposed to gdcm::DicomDir)
if ( !res )
{
- std::cout <<std::endl
- << "Sorry, " << fileName <<" not a gdcm-readable "
- << "DICOM / ACR Document"
- << std::endl;
- delete f;
- return 1;
+ std::cout <<std::endl
+ << "Sorry, " << fileName <<" not a gdcm-readable "
+ << "DICOM / ACR Document"
+ << std::endl;
+ f->Delete();
+ return 1;
}
std::cout << fileName << " is readable " << std::endl;
fp->close();
delete fp;
- delete f;
+ f->Delete();
return 0;
}
it != fileList.end();
++it )
{
- f = new gdcm::File( );
+ f = gdcm::File::New( );
f->SetLoadMode(loadMode);
f->SetFileName( it->c_str() );
bool res = f->Load();
if ( !res )
{
- delete f;
+ f->Delete();
continue;
}
fp->close();
delete fp;
- delete f;
- }
+ f->Delete();
+ }
}
return 0;
}
Program: gdcm
Module: $RCSfile: PrintDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:43 $
- Version: $Revision: 1.29 $
+ Date: $Date: 2005/10/25 14:52:27 $
+ Version: $Revision: 1.30 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// new gdcm2 style
- f = new gdcm::DicomDir();
+ f = gdcm::DicomDir::New();
f->SetFileName ( fileName );
f->Load( );
<<"' is not readable"<<std::endl
<<" ...Failed"<<std::endl;
- delete f;
+ f->Delete();
return 1;
}
<<" has no patient"<<std::endl
<<" ...Failed"<<std::endl;
- delete f;
+ f->Delete();
return 1;
}
// Structure use Examples
switch (detailLevel)
- {
- case 1:
- std::cout << std::endl << std::endl
- << " = PATIENT List =========================================="
- << std::endl<< std::endl;
-
- pa = f->GetFirstPatient();
- while (pa)
- {
- std::cout << "Pat.Name:[" << pa->GetEntryString(0x0010, 0x0010) <<"]"; // Patient's Name
- std::cout << " Pat.ID:[";
- std::cout << pa->GetEntryString(0x0010, 0x0020) << "]" << std::endl; // Patient ID
- pa = f->GetNextPatient();
- }
- break;
-
- case 2:
- std::cout << std::endl << std::endl
- << " = PATIENT/STUDY List ======================================="
- << std::endl<< std::endl;
-
- pa = f->GetFirstPatient();
- while ( pa ) // on degouline les PATIENT de ce DICOMDIR
- {
- std::cout << "Pat.Name:[" << pa->GetEntryString(0x0010, 0x0010) <<"]"; // Patient's Name
- std::cout << " Pat.ID:[";
- std::cout << pa->GetEntryString(0x0010, 0x0020) << "]" << std::endl; // Patient ID
- st = pa->GetFirstStudy();
- while ( st ) { // on degouline les STUDY de ce patient
- std::cout << "--- Stud.descr:[" << st->GetEntryString(0x0008, 0x1030) << "]"; // Study Description
- std::cout << " Stud.ID:[" << st->GetEntryString(0x0020, 0x0010) << "]"; // Study ID
- std::cout << std::endl;
- st = pa->GetNextStudy();
+ {
+ case 1:
+ std::cout << std::endl << std::endl
+ << " = PATIENT List =========================================="
+ << std::endl<< std::endl;
+
+ pa = f->GetFirstPatient();
+ while (pa)
+ {
+ std::cout << "Pat.Name:[" << pa->GetEntryString(0x0010, 0x0010) <<"]"; // Patient's Name
+ std::cout << " Pat.ID:[";
+ std::cout << pa->GetEntryString(0x0010, 0x0020) << "]" << std::endl; // Patient ID
+ pa = f->GetNextPatient();
}
- pa = f->GetNextPatient();
- }
- break;
+ break;
+
+ case 2:
+ std::cout << std::endl << std::endl
+ << " = PATIENT/STUDY List ======================================="
+ << std::endl<< std::endl;
+
+ pa = f->GetFirstPatient();
+ while ( pa ) // on degouline les PATIENT de ce DICOMDIR
+ {
+ std::cout << "Pat.Name:[" << pa->GetEntryString(0x0010, 0x0010) <<"]"; // Patient's Name
+ std::cout << " Pat.ID:[";
+ std::cout << pa->GetEntryString(0x0010, 0x0020) << "]" << std::endl; // Patient ID
+ st = pa->GetFirstStudy();
+ while ( st )
+ { // on degouline les STUDY de ce patient
+ std::cout << "--- Stud.descr:[" << st->GetEntryString(0x0008, 0x1030) << "]"; // Study Description
+ std::cout << " Stud.ID:[" << st->GetEntryString(0x0020, 0x0010) << "]"; // Study ID
+ std::cout << std::endl;
+ st = pa->GetNextStudy();
+ }
+ pa = f->GetNextPatient();
+ }
+ break;
+
+ case 3:
+ std::cout << std::endl << std::endl
+ << " = PATIENT/STUDY/SERIE List =================================="
+ << std::endl<< std::endl;
+
+ pa = f->GetFirstPatient();
+ while ( pa ) // on degouline les PATIENT de ce DICOMDIR
+ {
+ // Patient's Name, Patient ID
+ std::cout << "Pat.Name:[" << pa->GetEntryString(0x0010, 0x0010) <<"]"; // Patient's Name
+ std::cout << " Pat.ID:[";
+ std::cout << pa->GetEntryString(0x0010, 0x0020) << "]" << std::endl; // Patient ID
+
+ st = pa->GetFirstStudy();
+ while ( st )
+ { // on degouline les STUDY de ce patient
+ std::cout << "--- Stud.descr:[" << st->GetEntryString(0x0008, 0x1030) << "]"; // Study Description
+ std::cout << " Stud.ID:[" << st->GetEntryString(0x0020, 0x0010) << "]"; // Study ID
+ std::cout << std::endl;
+
+ se = st->GetFirstSerie();
+ while ( se )
+ { // on degouline les SERIES de cette study
+ std::cout << "--- --- Ser.Descr:["<< se->GetEntryString(0x0008, 0x103e)<< "]"; // Series Description
+ std::cout << " Ser.nb:[" << se->GetEntryString(0x0020, 0x0011); // Series number
+ std::cout << "] Mod.:[" << se->GetEntryString(0x0008, 0x0060) << "]"; // Modality
+ std::cout << std::endl;
+ se = st->GetNextSerie();
+ }
- case 3:
- std::cout << std::endl << std::endl
- << " = PATIENT/STUDY/SERIE List =================================="
- << std::endl<< std::endl;
+ vs = st->GetFirstVisit();
+ while ( vs )
+ { // on degouline les VISIT de cette study
+ std::cout << "--- --- VISIT: ";
+ std::cout << " Ref. File ID :[" << vs->GetEntryString(0x0004, 0x1500) << "]"; // Referenced File ID
+ std::cout << " Inst.Name:[" << vs->GetEntryString(0x0008,0x0080) << "]"; // Institution Name
+ std::cout << " Adm.ID:[" << vs->GetEntryString(0x0038, 0x0010) << "]"; // Admission ID
+ std::cout << " Adm. date:[" << vs->GetEntryString(0x0038, 0x0020) << "]"; // Admitting Date
+ std::cout << std::endl;
+ vs = st->GetNextVisit();
+ }
- pa = f->GetFirstPatient();
- while ( pa ) // on degouline les PATIENT de ce DICOMDIR
- {
- // Patient's Name, Patient ID
- std::cout << "Pat.Name:[" << pa->GetEntryString(0x0010, 0x0010) <<"]"; // Patient's Name
- std::cout << " Pat.ID:[";
- std::cout << pa->GetEntryString(0x0010, 0x0020) << "]" << std::endl; // Patient ID
-
- st = pa->GetFirstStudy();
- while ( st ) { // on degouline les STUDY de ce patient
- std::cout << "--- Stud.descr:[" << st->GetEntryString(0x0008, 0x1030) << "]"; // Study Description
- std::cout << " Stud.ID:[" << st->GetEntryString(0x0020, 0x0010) << "]"; // Study ID
- std::cout << std::endl;
-
- se = st->GetFirstSerie();
- while ( se ) { // on degouline les SERIES de cette study
- std::cout << "--- --- Ser.Descr:["<< se->GetEntryString(0x0008, 0x103e)<< "]"; // Series Description
- std::cout << " Ser.nb:[" << se->GetEntryString(0x0020, 0x0011); // Series number
- std::cout << "] Mod.:[" << se->GetEntryString(0x0008, 0x0060) << "]"; // Modality
- std::cout << std::endl;
- se = st->GetNextSerie();
- }
-
- vs = st->GetFirstVisit();
- while ( vs ) { // on degouline les VISIT de cette study
- std::cout << "--- --- VISIT: ";
- std::cout << " Ref. File ID :[" << vs->GetEntryString(0x0004, 0x1500) << "]"; // Referenced File ID
- std::cout << " Inst.Name:[" << vs->GetEntryString(0x0008,0x0080) << "]"; // Institution Name
- std::cout << " Adm.ID:[" << vs->GetEntryString(0x0038, 0x0010) << "]"; // Admission ID
- std::cout << " Adm. date:[" << vs->GetEntryString(0x0038, 0x0020) << "]"; // Admitting Date
- std::cout << std::endl;
- vs = st->GetNextVisit();
+ st = pa->GetNextStudy();
}
+ pa = f->GetNextPatient();
+ }
+ break;
+
+ case 4:
+ std::cout << std::endl << std::endl
+ << " = PATIENT/STUDY/SERIE/IMAGE List ============================"
+ << std::endl<< std::endl;
+
+ pa = f->GetFirstPatient();
+ while ( pa )
+ { // les PATIENT de ce DICOMDIR
+ // Patient's Name, Patient ID
+ std::cout << "Pat.Name:[" << pa->GetEntryString(0x0010, 0x0010) <<"]"; // Patient's Name
+ std::cout << " Pat.ID:[";
+ std::cout << pa->GetEntryString(0x0010, 0x0020) << "]" << std::endl; // Patient ID
+
+ st = pa->GetFirstStudy();
+ while ( st )
+ { // on degouline les STUDY de ce patient
+ std::cout << "--- Stud.descr:[" << st->GetEntryString(0x0008, 0x1030) << "]"; // Study Description
+ std::cout << " Stud.ID:[" << st->GetEntryString(0x0020, 0x0010) << "]"; // Study ID
+ std::cout << std::endl;
+
+ vs = st->GetFirstVisit();
+ while ( vs )
+ { // on degouline les VISIT de cette study
+ std::cout << "--- --- VISIT: ";
+ std::cout << " Ref. File ID :[" << vs->GetEntryString(0x0004, 0x1500) << "]"; // Referenced File ID
+ std::cout << " Inst.Name:[" << vs->GetEntryString(0x0008,0x0080) << "]"; // Institution Name
+ std::cout << " Adm.ID:[" << vs->GetEntryString(0x0038, 0x0010) << "]"; // Admission ID
+ std::cout << " Adm. date:[" << vs->GetEntryString(0x0038, 0x0020) << "]"; // Admitting Date
+ std::cout << std::endl;
+ vs = st->GetNextVisit();
+ }
- st = pa->GetNextStudy();
+ se = st->GetFirstSerie();
+ while ( se )
+ { // on degouline les SERIES de cette study
+ std::cout << "--- --- Ser.Descr:["<< se->GetEntryString(0x0008, 0x103e)<< "]"; // Series Description
+ std::cout << " Ser.nb:[" << se->GetEntryString(0x0020, 0x0011); // Series number
+ std::cout << "] Mod.:[" << se->GetEntryString(0x0008, 0x0060) << "]"; // Modality
+ std::cout << std::endl;
+
+ im = se->GetFirstImage();
+ while ( im )
+ { // on degouline les Images de cette serie
+ std::cout << "--- --- --- "<< " IMAGE Ref. File ID :[" << im->GetEntryString(0x0004, 0x1500)
+ << "]" << std::endl; // File name (Referenced File ID)
+ im = se->GetNextImage();
+ }
+ se = st->GetNextSerie();
+ }
+ st = pa->GetNextStudy();
+ }
+ pa = f->GetNextPatient();
}
- pa = f->GetNextPatient();
- }
- break;
-
- case 4:
- std::cout << std::endl << std::endl
- << " = PATIENT/STUDY/SERIE/IMAGE List ============================"
- << std::endl<< std::endl;
-
- pa = f->GetFirstPatient();
- while ( pa ) { // les PATIENT de ce DICOMDIR
- // Patient's Name, Patient ID
- std::cout << "Pat.Name:[" << pa->GetEntryString(0x0010, 0x0010) <<"]"; // Patient's Name
- std::cout << " Pat.ID:[";
- std::cout << pa->GetEntryString(0x0010, 0x0020) << "]" << std::endl; // Patient ID
-
- st = pa->GetFirstStudy();
- while ( st ) { // on degouline les STUDY de ce patient
- std::cout << "--- Stud.descr:[" << st->GetEntryString(0x0008, 0x1030) << "]"; // Study Description
- std::cout << " Stud.ID:[" << st->GetEntryString(0x0020, 0x0010) << "]"; // Study ID
- std::cout << std::endl;
-
- vs = st->GetFirstVisit();
- while ( vs ) { // on degouline les VISIT de cette study
- std::cout << "--- --- VISIT: ";
- std::cout << " Ref. File ID :[" << vs->GetEntryString(0x0004, 0x1500) << "]"; // Referenced File ID
- std::cout << " Inst.Name:[" << vs->GetEntryString(0x0008,0x0080) << "]"; // Institution Name
- std::cout << " Adm.ID:[" << vs->GetEntryString(0x0038, 0x0010) << "]"; // Admission ID
- std::cout << " Adm. date:[" << vs->GetEntryString(0x0038, 0x0020) << "]"; // Admitting Date
- std::cout << std::endl;
- vs = st->GetNextVisit();
- }
+ break;
- se = st->GetFirstSerie();
- while ( se ) { // on degouline les SERIES de cette study
- std::cout << "--- --- Ser.Descr:["<< se->GetEntryString(0x0008, 0x103e)<< "]"; // Series Description
- std::cout << " Ser.nb:[" << se->GetEntryString(0x0020, 0x0011); // Series number
- std::cout << "] Mod.:[" << se->GetEntryString(0x0008, 0x0060) << "]"; // Modality
- std::cout << std::endl;
-
- im = se->GetFirstImage();
- while ( im ) { // on degouline les Images de cette serie
- std::cout << "--- --- --- "<< " IMAGE Ref. File ID :[" << im->GetEntryString(0x0004, 0x1500)
- << "]" << std::endl; // File name (Referenced File ID)
- im = se->GetNextImage();
- }
- se = st->GetNextSerie();
- }
- st = pa->GetNextStudy();
- }
- pa = f->GetNextPatient();
- }
- break;
-
- case 5:
- std::cout << std::endl << std::endl
- << " = DICOMDIR full content =========================================="
- << std::endl<< std::endl;
- f->Print();
- break;
+ case 5:
+ std::cout << std::endl << std::endl
+ << " = DICOMDIR full content =========================================="
+ << std::endl<< std::endl;
+ f->Print();
+ break;
} // end switch
else
std::cout <<std::endl<<fileName<<" is NOT Readable"<<std::endl;
std::cout<<std::flush;
- delete f;
+ f->Delete();
return(0);
}
Program: gdcm
Module: $RCSfile: PrintFile.cxx,v $
Language: C++
- Date: $Date: 2005/10/20 08:53:21 $
- Version: $Revision: 1.65 $
+ Date: $Date: 2005/10/25 14:52:27 $
+ Version: $Revision: 1.66 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// any kind of gdcm-Parsable *document*
// not only gdcm::File (as opposed to gdcm::DicomDir)
- gdcm::File *f = new gdcm::File();
+ gdcm::File *f = gdcm::File::New();
f->SetLoadMode(loadMode);
f->SetFileName( fileName );
<< std::endl;
std::cout << "use 'PrintFile filein=... debug' to try to guess the pb"
<< std::endl;
- delete f;
+ f->Delete();
return 0;
}
- gdcm::FileHelper *fh = new gdcm::FileHelper(f);
+ gdcm::FileHelper *fh = gdcm::FileHelper::New(f);
fh->SetPrintLevel( level );
fh->Print();
std::cout << "Transfer Syntax not loaded. " << std::endl
<< "Better you increase MAX_SIZE_LOAD_ELEMENT_VALUE"
<< std::endl;
+ f->Delete();
return 0;
}
gdcm::SQItem *sqi= modLutSeq->GetFirstSQItem();
if ( !sqi )
{
- std::string lutDescriptor = sqi->GetEntryString(0x0028,0x3002);
+ std::string lutDescriptor = sqi->GetEntryString(0x0028,0x3002);
int length; // LUT length in Bytes
int deb; // Subscript of the first Lut Value
int nbits; // Lut item size (in Bits)
}
std::cout<<std::flush;
- delete f;
+ f->Delete();
delete fh;
}
else // ====== Deal with a Directory ======
gdcm::DirListType fileList = dirList.GetFilenames();
gdcm::File *f;
bool res;
+
for( gdcm::DirListType::iterator it = fileList.begin();
it != fileList.end();
++it )
{
std::cout << std::endl<<" Start processing :[" << it->c_str() << "]"
<< std::endl;
- f = new gdcm::File();
+ f = gdcm::File::New();
f->SetLoadMode(loadMode);
f->SetFileName( it->c_str() );
std::cout << "use 'PrintFile filein=... debug' "
<< "to try to guess the pb"
<< std::endl;
- delete f;
+ f->Delete();
continue;
}
- gdcm::FileHelper *fh = new gdcm::FileHelper(f);
+ gdcm::FileHelper *fh = gdcm::FileHelper::New(f);
fh->SetPrintLevel( level );
fh->Print();
else
std::cout <<std::endl<<it->c_str()<<" is NOT Readable"<<std::endl;
std::cout << "\n\n" << std::endl;
- delete f;
- delete fh;
+ f->Delete();
+ fh->Delete();
}
std::cout<<std::flush;
}
Program: gdcm
Module: $RCSfile: ReWrite.cxx,v $
Language: C++
- Date: $Date: 2005/10/21 08:39:31 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2005/10/25 14:52:27 $
+ Version: $Revision: 1.15 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// ----------- End Arguments Manager ---------
- gdcm::File *f = new gdcm::File();
+ gdcm::File *f = gdcm::File::New();
f->SetLoadMode( loadMode );
f->SetFileName( fileName );
bool res = f->Load();
if ( !res )
{
- delete f;
+ f->Delete();
return 0;
}
if (!f->IsReadable())
{
std::cerr << "Sorry, not a Readable DICOM / ACR File" <<std::endl;
- delete f;
+ f->Delete();
return 0;
}
- gdcm::FileHelper *fh = new gdcm::FileHelper(f);
+ gdcm::FileHelper *fh = gdcm::FileHelper::New(f);
void *imageData;
int dataSize;
switch (mode[0])
{
- case 'A' :
- case 'a' :
- // Writting an ACR file
- // from a full gdcm readable File
-
- std::cout << "WriteACR" << std::endl;
- fh->WriteAcr(outputFileName);
- break;
-
- case 'D' : // Not documented in the 'usage', because the method
- case 'd' : // is known to be bugged.
- // Writting a DICOM Implicit VR file
- // from a full gdcm readable File
-
- std::cout << "WriteDCM Implicit VR" << std::endl;
- fh->WriteDcmImplVR(outputFileName);
- break;
-
- case 'X' :
- case 'x' :
- // writting a DICOM Explicit VR
- // from a full gdcm readable File
-
- std::cout << "WriteDCM Explicit VR" << std::endl;
- // fh->WriteDcmExplVR(outputFileName);
- // Try this one :
- fh->SetWriteTypeToDcmExplVR();
- fh->Write(outputFileName);
- break;
-
- case 'R' :
- case 'r' :
- // Writting a Raw File,
-
- std::cout << "WriteRaw" << std::endl;
- fh->WriteRawData(outputFileName);
- break;
+ case 'A' :
+ case 'a' :
+ // Writting an ACR file
+ // from a full gdcm readable File
+ std::cout << "WriteACR" << std::endl;
+ fh->WriteAcr(outputFileName);
+ break;
+
+ case 'D' : // Not documented in the 'usage', because the method
+ case 'd' : // is known to be bugged.
+ // Writting a DICOM Implicit VR file
+ // from a full gdcm readable File
+ std::cout << "WriteDCM Implicit VR" << std::endl;
+ fh->WriteDcmImplVR(outputFileName);
+ break;
+
+ case 'X' :
+ case 'x' :
+ // writting a DICOM Explicit VR
+ // from a full gdcm readable File
+ std::cout << "WriteDCM Explicit VR" << std::endl;
+ // fh->WriteDcmExplVR(outputFileName);
+ // Try this one :
+ fh->SetWriteTypeToDcmExplVR();
+ fh->Write(outputFileName);
+ break;
+
+ case 'R' :
+ case 'r' :
+ // Writting a Raw File,
+ std::cout << "WriteRaw" << std::endl;
+ fh->WriteRawData(outputFileName);
+ break;
// Just for fun :
// Write a 'Video inverse' version of the file.
// *Not* described, on purpose, in the USAGE
-
- case 'V' :
- case 'v' :
-
- if ( fh->GetFile()->GetBitsAllocated() == 8)
- {
- std::cout << "videoinv for 8 bits" << std::endl;
- for (int i=0; i<dataSize; i++)
- {
- ((uint8_t*)imageData)[i] = 255 - ((uint8_t*)imageData)[i];
- }
- }
- else
- {
- std::cout << "videoinv for 16 bits" << std::endl;
- for (int i=0; i<dataSize/2; i++)
- {
- ((uint16_t*)imageData)[i] = 65535 - ((uint16_t*)imageData)[i];
- }
- }
- std::cout << "WriteDCM Explicit VR + VideoInv" << std::endl;
- fh->WriteDcmExplVR(outputFileName);
- break;
-
+ case 'V' :
+ case 'v' :
+ if ( fh->GetFile()->GetBitsAllocated() == 8)
+ {
+ std::cout << "videoinv for 8 bits" << std::endl;
+ for (int i=0; i<dataSize; i++)
+ {
+ ((uint8_t*)imageData)[i] = 255 - ((uint8_t*)imageData)[i];
+ }
+ }
+ else
+ {
+ std::cout << "videoinv for 16 bits" << std::endl;
+ for (int i=0; i<dataSize/2; i++)
+ {
+ ((uint16_t*)imageData)[i] = 65535 - ((uint16_t*)imageData)[i];
+ }
+ }
+ std::cout << "WriteDCM Explicit VR + VideoInv" << std::endl;
+ fh->WriteDcmExplVR(outputFileName);
+ break;
}
- delete f;
- delete fh;
+
+ f->Delete();
+ fh->Delete();
return 0;
}
Program: gdcm
Module: $RCSfile: TestChangeHeader.cxx,v $
Language: C++
- Date: $Date: 2005/10/21 08:37:44 $
- Version: $Revision: 1.17 $
+ Date: $Date: 2005/10/25 14:52:27 $
+ Version: $Revision: 1.18 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
int main(int argc, char *argv[])
{
- if (argc < 3)
- {
- std::cerr << "usage :" << std::endl <<
- argv[0] << " fileNameForHeader fileNameForData" <<
- std::endl;
- return 1;
- }
+ if (argc < 3)
+ {
+ std::cerr << "usage :" << std::endl <<
+ argv[0] << " fileNameForHeader fileNameForData" <<
+ std::endl;
+ return 1;
+ }
- gdcm::File *h1 = new gdcm::File( );
- h1->SetFileName ( argv[1] );
- h1->Load( );
- gdcm::FileHelper *f1 = new gdcm::FileHelper( h1 );
-
- gdcm::File *h2 = new gdcm::File( );
- h2->SetFileName ( argv[2] );
- h2->Load( );
- gdcm::FileHelper *f2 = new gdcm::FileHelper( h2 );
-
+ gdcm::File *h1 = gdcm::File::New( );
+ h1->SetFileName ( argv[1] );
+ h1->Load( );
+ gdcm::FileHelper *f1 = gdcm::FileHelper::New( h1 );
+
+ gdcm::File *h2 = gdcm::File::New( );
+ h2->SetFileName ( argv[2] );
+ h2->Load( );
+ gdcm::FileHelper *f2 = gdcm::FileHelper::New( h2 );
+
- // 0018 1310 US ACQ Acquisition Matrix
- gdcm::DictEntry *dictEntry =
- f2->GetFile()->GetPubDict()->GetEntry( 0x0018, 1310 );
- std::cerr << std::hex << dictEntry->GetGroup() << ","
- << dictEntry->GetElement() << std::endl;
+ // 0018 1310 US ACQ Acquisition Matrix
+ gdcm::DictEntry *dictEntry =
+ f2->GetFile()->GetPubDict()->GetEntry( 0x0018, 1310 );
+ std::cerr << std::hex << dictEntry->GetGroup() << ","
+ << dictEntry->GetElement() << std::endl;
- std::string matrix = f2->GetFile()->GetEntryString(0x0018, 0x1310);
- if(matrix != "gdcm::Unfound")
- {
- std::cerr << "Aquisition Matrix:" << matrix << std::endl;
- f1->GetFile()->InsertEntryString( matrix, 0x0018, 0x1310);
- }
+ std::string matrix = f2->GetFile()->GetEntryString(0x0018, 0x1310);
+ if(matrix != "gdcm::Unfound")
+ {
+ std::cerr << "Aquisition Matrix:" << matrix << std::endl;
+ f1->GetFile()->InsertEntryString( matrix, 0x0018, 0x1310);
+ }
- f1->GetImageData();
-
- h1->Print();
-
- f1->WriteDcmExplVR("output-matrix.dcm");
-
- delete f1;
- delete f2;
- delete h1;
- delete h2;
+ f1->GetImageData();
+
+ h1->Print();
+
+ f1->WriteDcmExplVR("output-matrix.dcm");
+
+ f1->Delete();
+ f2->Delete();
+ h1->Delete();
+ h2->Delete();
- return 0;
+ return 0;
}
Program: gdcm
Module: $RCSfile: TestCopyDicom.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:43 $
- Version: $Revision: 1.31 $
+ Date: $Date: 2005/10/25 14:52:27 $
+ Version: $Revision: 1.32 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
}
// don't modify identation in order to let this source xdiffable with ../Test
-
std::string filename = argv[1];
std::string output = argv[2];
return 1;
}
}
- gdcm::File *fileOr = new gdcm::File();
+ gdcm::File *fileOr = gdcm::File::New();
fileOr->SetFileName( filename );
fileOr->Load();
- gdcm::FileHelper *original = new gdcm::FileHelper( fileOr );
+ gdcm::FileHelper *original = gdcm::FileHelper::New( fileOr );
std::cout << "--- Original ----------------------" << std::endl;
- //original->GetFile()->Print();
- gdcm::FileHelper *copy = new gdcm::FileHelper( );
+ gdcm::FileHelper *copy = gdcm::FileHelper::New( );
copy->SetFileName( output );
copy->Load();
- //size_t dataSize;
uint8_t *imageData;
- //dataSize = original->GetImageDataSize();// just an accesor :useless here
imageData = original->GetImageData(); // VERY important :
// brings pixels into memory !
- //(void)imageData; // not enough to avoid warning with icc compiler
- //(void)dataSize; // not enough to avoid warning on 'Golgot'
std::cout << imageData << std::endl; // to avoid warning ?
}
else
{
- // We skip pb of SQ recursive exploration
- std::cout << "Skipped Sequence "
- << "------------- " << d->GetVR() << " "<< std::hex
- << d->GetGroup() << "," << d->GetElement()
- << std::endl;
+ // We skip pb of SQ recursive exploration
+ std::cout << "Skipped Sequence "
+ << "------------- " << d->GetVR() << " "<< std::hex
+ << d->GetGroup() << "," << d->GetElement()
+ << std::endl;
}
d=original->GetFile()->GetNextEntry();
}
- //copy->GetImageData();
- //copy->SetImageData(imageData, dataSize);
-
std::cout << "--- Copy ----------------------" << std::endl;
std::cout <<std::endl << "DO NOT care about Offset"
<<std::endl << std::endl;;
copy->WriteDcmExplVR( output );
-
- delete fileOr; // File
- delete original; // FileHelper
- delete copy; // FileHelper
+ fileOr->Delete(); // File
+ original->Delete(); // FileHelper
+ copy->Delete(); // FileHelper
return 0;
}
Program: gdcm
Module: $RCSfile: Volume2Dicom.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:43 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2005/10/25 14:52:27 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//const char *inputfile = argv[1];
std::string directory = argv[1];
-// itksys::SystemTools::ConvertToUnixSlashes( directory );
+ // itksys::SystemTools::ConvertToUnixSlashes( directory );
if (directory[directory.size()-1] != '/')
- directory += '/';
+ directory += '/';
std::cout << "Converting image into dicom in " << directory << std::endl;
- ////////////////////////////////////////////////////////////
- // Reading input image and getting some information //
- ////////////////////////////////////////////////////////////
- //std::cout << "Loading image " << inputfile << std::endl;
- //PixelType* imageData = input->GetPixelContainer()->GetImportPointer();
- uint8_t *imageData = new uint8_t[256*256*10];
- memset( imageData, 0, 256*256*10);
- std::cout << "Image Loaded." << std::endl;
-
- int sizex = 256;
- int sizey = 256;
- int sizez = 10;
- //float spacing[3] = { 1.0, 1.0, 1.5 };
- //float orig[3] = { 0.0, 0.0, 0.0 };
- int sliceSize = sizex*sizey*sizeof(uint8_t);
-
- ////////////////////////////////////////////////////////////
- // compute window center and window width //
- ////////////////////////////////////////////////////////////
- uint8_t min, max; min = max = imageData[0];
- for (int i=1; i<sizex*sizey*sizez; i++)
- {
- uint8_t val = imageData[i];
- if (val > max)
- max = val;
- if (val < min)
- min = val;
- }
- //float wcenter = (max+min) / 2.;
- //float wwidth = (max-min)>0 ? (max-min) : 1.;
-
- ////////////////////////////////////////////////////////////
- // Get file date and time //
- ////////////////////////////////////////////////////////////
- std::string filedate, filetime;
- //GetFileDateAndTime(inputfile, filedate, filetime);
-
- ////////////////////////////////////////////////////////////
- // Create a new dicom header and fill in some info //
- ////////////////////////////////////////////////////////////
- gdcm::File *f = new gdcm::File();
-
- //f->SetDateAndTime(filedate, filetime);
- //f->SetModality("CT");
- //f->SetPatientName( "TestPatient");
- //f->SetPatientID( "TestID");
- //f->SetStudyID( "1");
- //f->SetSeriesNumber( "1");
- //f->SetSliceThickness(spacing[2]);
- //f->SetSpaceBetweenSlices(spacing[2]);
- //f->SetXYSpacing( spacing[0], spacing[1]);
- //f->SetXSize(sizex);
- //f->SetYSize(sizey);
- //f->SetNbBitsAllocated(16);
- //f->SetNbBitsStored(12);
- //f->SetNbBitsStored(12);
- //f->SetPixelSigned(true);
- //f->SetCenter( wcenter);
- //f->SetWindow( wwidth);
-
- ////////////////////////////////////////////////////////////
- // Create a new dicom file object from the header //
- ////////////////////////////////////////////////////////////
- gdcm::FileHelper *fh = new gdcm::FileHelper(f);
- uint8_t *myData = fh->GetImageData(); // Get an Image pointer
- fh->SetImageData( myData, sliceSize); // This callback ensures that the internal
- // Pixel_Data of fh is set correctly
-
-
- ////////////////////////////////////////////////////////////
- // Iterate through the slices and save them to file //
- ////////////////////////////////////////////////////////////
- for (int z=0; z<sizez; z++)
- {
- // Set dicom relevant information for that slice
- //f->SetImageUIDFromSliceNumber(z);
- //f->SetImageLocation(orig[0],orig[1],orig[2]+z*spacing[2]);
-
- // copy image slice content
- memcpy(myData,imageData+z*sizex*sizey,sliceSize);
-
- // write the image
- std::string filename = directory + gdcm::Util::Format("%Image_%05d.dcm", z);
- std::cout << "Writing file " << filename;
- fh->WriteDcmExplVR(filename);
- std::cout << " OK" << std::endl;
- }
-
- ////////////////////////////////////////////////////////////
- // Free the allocated objects //
- ////////////////////////////////////////////////////////////
- // delete fh; // FIXME: these calls sometimes crashes under .NET ????
- // delete f;
-
- return 0;
+ ////////////////////////////////////////////////////////////
+ // Reading input image and getting some information //
+ ////////////////////////////////////////////////////////////
+ //std::cout << "Loading image " << inputfile << std::endl;
+ //PixelType* imageData = input->GetPixelContainer()->GetImportPointer();
+ uint8_t *imageData = new uint8_t[256*256*10];
+ memset( imageData, 0, 256*256*10);
+ std::cout << "Image Loaded." << std::endl;
+
+ int sizex = 256;
+ int sizey = 256;
+ int sizez = 10;
+ //float spacing[3] = { 1.0, 1.0, 1.5 };
+ //float orig[3] = { 0.0, 0.0, 0.0 };
+ int sliceSize = sizex*sizey*sizeof(uint8_t);
+
+ ////////////////////////////////////////////////////////////
+ // compute window center and window width //
+ ////////////////////////////////////////////////////////////
+ uint8_t min, max; min = max = imageData[0];
+ for (int i=1; i<sizex*sizey*sizez; i++)
+ {
+ uint8_t val = imageData[i];
+ if (val > max)
+ max = val;
+ if (val < min)
+ min = val;
+ }
+ //float wcenter = (max+min) / 2.;
+ //float wwidth = (max-min)>0 ? (max-min) : 1.;
+
+ ////////////////////////////////////////////////////////////
+ // Get file date and time //
+ ////////////////////////////////////////////////////////////
+ std::string filedate, filetime;
+ //GetFileDateAndTime(inputfile, filedate, filetime);
+
+ ////////////////////////////////////////////////////////////
+ // Create a new dicom header and fill in some info //
+ ////////////////////////////////////////////////////////////
+ gdcm::File *f = gdcm::File::New();
+
+ ////////////////////////////////////////////////////////////
+ // Create a new dicom file object from the header //
+ ////////////////////////////////////////////////////////////
+ gdcm::FileHelper *fh = gdcm::FileHelper::New(f);
+ uint8_t *myData = fh->GetImageData(); // Get an Image pointer
+ fh->SetImageData( myData, sliceSize); // This callback ensures that the internal
+ // Pixel_Data of fh is set correctly
+
+
+ ////////////////////////////////////////////////////////////
+ // Iterate through the slices and save them to file //
+ ////////////////////////////////////////////////////////////
+ for (int z=0; z<sizez; z++)
+ {
+ // Set dicom relevant information for that slice
+ //f->SetImageUIDFromSliceNumber(z);
+ //f->SetImageLocation(orig[0],orig[1],orig[2]+z*spacing[2]);
+
+ // copy image slice content
+ memcpy(myData,imageData+z*sizex*sizey,sliceSize);
+
+ // write the image
+ std::string filename = directory + gdcm::Util::Format("%Image_%05d.dcm", z);
+ std::cout << "Writing file " << filename;
+ fh->WriteDcmExplVR(filename);
+ std::cout << " OK" << std::endl;
+ }
+
+ ////////////////////////////////////////////////////////////
+ // Free the allocated objects //
+ ////////////////////////////////////////////////////////////
+ fh->Delete();
+ f->Delete();
+
+ return 0;
}
Program: gdcm
Module: $RCSfile: WriteDicomSimple.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:43 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2005/10/25 14:52:27 $
+ Version: $Revision: 1.15 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// Step 1 : Create the header of the image
- gdcm::File *header = new gdcm::File();
+ gdcm::File *header = gdcm::File::New();
std::ostringstream str;
// Set the image size
std::cerr << "-------------------------------\n"
<< "Error while creating the file\n"
<< "This file is considered to be not readable\n";
-
+ header->Delete();
return 1;
}
}
// Step 3 : Create the file of the image
- gdcm::FileHelper *file = new gdcm::FileHelper(header);
+ gdcm::FileHelper *file = gdcm::FileHelper::New(header);
file->SetImageData(imageData,size);
// Step 4 : Set the writting mode and write the image
<< "File :" << fileName << std::endl;
delete[] imageData;
- delete file;
- delete header;
+ file->Delete();
+ header->Delete();
return 0;
default :
std::cout << "-------------------------------\n"
<< "Write mode undefined...\n"
<< "No file written\n";
-
delete[] imageData;
- delete file;
- delete header;
+ file->Delete();
+ header->Delete();
return 1;
}
}
delete[] imageData;
- delete file;
- delete header;
+ file->Delete();
+ header->Delete();
return 0;
}
Program: gdcm
Module: $RCSfile: WriteRead.cxx,v $
Language: C++
- Date: $Date: 2005/07/08 12:02:02 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2005/10/25 14:52:27 $
+ Version: $Revision: 1.15 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
int dataSize, dataSize2;
if( argc < 2 )
- {
- std::cerr << "Usage " << argv[0] << " image.dcm" << std::endl;
- return 1;
- }
+ {
+ std::cerr << "Usage " << argv[0] << " image.dcm" << std::endl;
+ return 1;
+ }
std::string fileName = argv[1];
// --------------------- we read the input image
std::cout << argv[1] << std::endl;
- e1 = new gdcm::File( );
+ e1 = gdcm::File::New( );
e1->SetFileName( fileName );
e1->Load();
- if (!e1->IsReadable()) {
- std::cerr << "Sorry, " << fileName <<" not a Readable DICOM / ACR File"
- <<std::endl;
- return 0;
+ if (!e1->IsReadable())
+ {
+ std::cerr << "Sorry, " << fileName <<" not a Readable DICOM / ACR File"
+ <<std::endl;
+ e1->Delete();
+ return 1;
}
- f1 = new gdcm::FileHelper(e1);
+ f1 = gdcm::FileHelper::New(e1);
imageData= f1->GetImageData();
dataSize = f1->GetImageDataSize();
// --------------------- we write it as an Explicit VR DICOM file
- fileNameToWrite = "temp.XDCM";
- std::cout << "WriteDCM Explicit VR" << std::endl;
- f1->WriteDcmExplVR(fileNameToWrite);
+ fileNameToWrite = "temp.XDCM";
+ std::cout << "WriteDCM Explicit VR" << std::endl;
+ f1->WriteDcmExplVR(fileNameToWrite);
// --------------------- we read the written image
- e2 = new gdcm::File( );
+ e2 = gdcm::File::New( );
e2->SetFileName( fileNameToWrite );
e2->Load();
- if (!e2->IsReadable()) {
- std::cerr << "Sorry, " << fileNameToWrite << " not a Readable DICOM / ACR File"
- <<std::endl;
- return 0;
+ if (!e2->IsReadable())
+ {
+ std::cerr << "Sorry, " << fileNameToWrite << " not a Readable DICOM / ACR File"
+ <<std::endl;
+ e1->Delete();
+ e2->Delete();
+ f1->Delete();
+ return 1;
}
- f2 = new gdcm::FileHelper(e2);
+ f2 = gdcm::FileHelper::New(e2);
imageData2= f2->GetImageData();
dataSize2 = f2->GetImageDataSize();
// --------------------- we compare the pixel areas
- if (dataSize != dataSize2) {
- std::cout << " ----------------------------------------- "
- << "Bad shot! Lengthes are different : "
- << dataSize << " # " << dataSize2
- << " for file : " << fileName << std::endl;
+ if (dataSize != dataSize2)
+ {
+ std::cout << " ----------------------------------------- "
+ << "Bad shot! Lengthes are different : "
+ << dataSize << " # " << dataSize2
+ << " for file : " << fileName << std::endl;
- return 0;
- }
- if (int res=memcmp(imageData,imageData2,dataSize) !=0) {
- std::cout << " ----------------------------------------- "
- << "Bad shot! Pixels are different : "
- << " for file : " << fileName << std::endl;
- std::cout << "memcmp(imageData,imageData2,dataSize) = " << res << std::endl;
- return 1;
- }
+ e1->Delete();
+ e2->Delete();
+ f1->Delete();
+ f2->Delete();
+ return 1;
+ }
+ if (int res=memcmp(imageData,imageData2,dataSize) !=0)
+ {
+ std::cout << " ----------------------------------------- "
+ << "Bad shot! Pixels are different : "
+ << " for file : " << fileName << std::endl;
+ std::cout << "memcmp(imageData,imageData2,dataSize) = " << res << std::endl;
+ e1->Delete();
+ e2->Delete();
+ f1->Delete();
+ f2->Delete();
+ return 1;
+ }
- //If we reach here everything is fine, return 0 then:
- return 0;
+ e1->Delete();
+ e2->Delete();
+ f1->Delete();
+ f2->Delete();
+ return 0;
}
Program: gdcm
Module: $RCSfile: exColorToRGB.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:43 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2005/10/25 14:52:27 $
+ Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
std::cout << argv[1] << std::endl;
- gdcm::File *f = new gdcm::File();
+ gdcm::File *f = gdcm::File::New();
f->SetLoadMode( gdcm::LD_ALL);
f->SetFileName( fileName );
bool res = f->Load();
- if (!res) {
+ if (!res)
+ {
std::cerr << "Sorry, " << fileName <<" not a gdcm-readable "
<< "DICOM / ACR File"
<<std::endl;
+ f->Delete();
return 0;
}
std::cout << " ... is readable " << std::endl;
/*
- if (!f->IsMonochrome()) {
+ if (!f->IsMonochrome())
+ {
std::cerr << "Sorry, " << fileName <<" not a 'color' File "
<< " "
<<std::endl;
+ f->Delete();
return 0;
}
*/
// ============================================================
// We need a gdcm::FileHelper, since we want to load the pixels
- gdcm::FileHelper *fh = new gdcm::FileHelper(f);
+ gdcm::FileHelper *fh = gdcm::FileHelper::New(f);
// uint8_t DOESN'T mean it's mandatory for the image to be a 8 bits one !
// It's just for prototyping.
{
std::cerr << "Sorry, Pixels of" << fileName <<" are not "
<< " gdcm-readable." << std::endl;
+ f->Delete();
return 0;
}
// ------ without Sequences -------------
- gdcm::FileHelper *copy = new gdcm::FileHelper( );
+ gdcm::FileHelper *copy = gdcm::FileHelper::New( );
copy->SetFileName( output );
copy->Load();
copy->WriteDcmExplVR( output );
-
- delete f;
- delete fh;
- delete copy;
+ f->Delete();
+ fh->Delete();
+ copy->Delete();
exit (0);
}
Program: gdcm
Module: $RCSfile: exCurveData.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:43 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2005/10/25 14:52:27 $
+ Version: $Revision: 1.5 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// Read the input image.
// ============================================================
- f = new gdcm::File( );
+ f = gdcm::File::New( );
f->SetLoadMode(gdcm::LD_NOSEQ | gdcm::LD_NOSHADOW);
f->SetFileName( fileName );
std::cout << "Sorry, " << fileName <<" not a gdcm-readable "
<< "DICOM / ACR File"
<<std::endl;
- delete f;
+ f->Delete();
return 1;
}
std::cout << " ... is readable " << std::endl;
if (curve_data_str == gdcm::GDCM_UNFOUND)
{
std::cout << " Image doesn't contain any Curve Data" << std::endl;
- delete f;
+ f->Delete();
return 1;
}
std::cout << " File is read! " << std::endl;
break;
default:
std::cerr << "Error don't know the type: " << data_rep_str << std::endl;
- delete f;
+ f->Delete();
return 1;
}
// Just to make sure that values read are consistant and we won't read out of bound data:
//o.write((char*)curve_data, num_points*sz);
//o.close();
- delete f;
+ f->Delete();
return 0;
}
Program: gdcm
Module: $RCSfile: exExtractDicomTags.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:44 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2005/10/25 14:52:27 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
int loadMode = 0x0; // load everything
- gdcm::File *f = new gdcm::File();
+ gdcm::File *f = gdcm::File::New();
f->SetLoadMode( loadMode );
f->SetFileName( fileName );
bool res = f->Load();
if ( !res )
{
- delete f;
+ f->Delete();
return 0;
}
if (!f->IsReadable())
{
std::cout << "NOT a Dicom File : " << fileName <<std::endl;
- delete f;
+ f->Delete();
return 1;
}
std::cout << "GetYSpacing = [" << sy << "]" << std::endl;
std::cout << "GetZSpacing = [" << sz << "]" << std::endl;
+ f->Delete();
return 0;
}
Program: gdcm
Module: $RCSfile: exExtractTag.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:44 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2005/10/25 14:52:27 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// Read the input image.
// ============================================================
- f = new gdcm::File( );
+ f = gdcm::File::New( );
//f->SetLoadMode(gdcm::LD_NOSEQ | gdcm::LD_NOSHADOW);
f->SetFileName( fileName );
std::cerr << "Sorry, " << fileName << " not a gdcm-readable "
<< "DICOM / ACR File"
<< std::endl;
- delete f;
+ f->Delete();
return 1;
}
std::cout << " ... is readable " << std::endl;
{
gdcm::DictEntry *dictEntry = f->GetPubDict()->GetEntry( group, elem);
std::cerr << "Image doesn't contain any tag: " << dictEntry->GetName() << std::endl;
- delete f;
+ f->Delete();
return 1;
}
if( !dicom_tag )
{
std::cerr << "Sorry DataEntry only please" << std::endl;
- delete f;
+ f->Delete();
return 1;
}
if( !o )
{
std::cerr << "Problem opening file: " << argv[4] << std::endl;
- delete f;
+ f->Delete();
return 1;
}
o.write((char*)dicom_tag->GetBinArea(), dicom_tag->GetLength());
o.close();
- delete f;
+ f->Delete();
return 0;
}
Program: gdcm
Module: $RCSfile: exGC.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:44 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2005/10/25 14:52:27 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
std::cout << argv[1] << std::endl;
- gdcm::File *f = new gdcm::File();
+ gdcm::File *f = gdcm::File::New();
f->SetLoadMode( gdcm::LD_ALL);
f->SetFileName( fileName );
bool res = f->Load();
std::cerr << "Sorry, " << fileName <<" not a gdcm-readable "
<< "DICOM / ACR File"
<<std::endl;
+ f->Delete();
return 0;
}
std::cout << " ... is readable " << std::endl;
// ============================================================
// We need a gdcm::FileHelper, since we want to load the pixels
- gdcm::FileHelper *fh = new gdcm::FileHelper(f);
+ gdcm::FileHelper *fh = gdcm::FileHelper::New(f);
// (unit8_t DOESN'T mean it's mandatory for the image to be a 8 bits one)
{
std::cerr << "Sorry, Pixels of" << fileName <<" are not "
<< " gdcm-readable." << std::endl;
+ f->Delete();
+ fh->Delete();
return 0;
}
// ------ without Sequences -------------
- gdcm::FileHelper *copy = new gdcm::FileHelper( );
+ gdcm::FileHelper *copy = gdcm::FileHelper::New( );
copy->SetFileName( output );
copy->Load();
}
}
- std::cout << n << " points put to black (within "
- << imageSize/3 << ")" << std::endl;
+ std::cout << n << " points put to black (within "
+ << imageSize/3 << ")" << std::endl;
n = 0;
for (i = 0; i<imageSize/3; i++)
{
- if ( ((rgb8_t *)imageData)[i].r < threshold
- &&
- ((rgb8_t *)imageData)[i].g < threshold
- &&
- ((rgb8_t *)imageData)[i].b < threshold )
+ if ( ((rgb8_t *)imageData)[i].r < threshold
+ &&
+ ((rgb8_t *)imageData)[i].g < threshold
+ &&
+ ((rgb8_t *)imageData)[i].b < threshold )
{
n++;
((rgb8_t *)imageData)[i].r = (unsigned char)background;
copy->WriteDcmExplVR( output );
- delete f;
- delete fh;
- delete copy;
+ f->Delete();
+ fh->Delete();
+ copy->Delete();
exit (0);
}
Program: gdcm
Module: $RCSfile: exGrey2RGB.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:44 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2005/10/25 14:52:28 $
+ Version: $Revision: 1.5 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
}
}
- gdcm::FileHelper *fh = new gdcm::FileHelper( );
+ gdcm::FileHelper *fh = gdcm::FileHelper::New( );
fh->SetFileName( filename );
fh->Load();
fh->SetImageData(imageDataRGB, dataSize*3);
fh->WriteDcmExplVR( output );
+ fh->Delete();
+
return 0;
}
Program: gdcm
Module: $RCSfile: exImageLighten.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:44 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2005/10/25 14:52:28 $
+ Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
std::cout << argv[1] << std::endl;
- gdcm::File *f = new gdcm::File();
+ gdcm::File *f = gdcm::File::New();
f->SetLoadMode( gdcm::LD_ALL);
f->SetFileName( fileName );
bool res = f->Load();
std::cerr << "Sorry, " << fileName <<" not a gdcm-readable "
<< "DICOM / ACR File"
<<std::endl;
+ f->Delete();
return 0;
}
std::cout << " ... is readable " << std::endl;
// to load the Palettes Color (if any)
// First, create a gdcm::FileHelper
- gdcm::FileHelper *fh = new gdcm::FileHelper(f);
+ gdcm::FileHelper *fh = gdcm::FileHelper::New(f);
// Load the pixels, DO NOT transform LUT (if any) into RGB Pixels
uint8_t *imageDataRaw = fh->GetImageDataRaw();
// Create a new gdcm::Filehelper, to hold new image.
// ============================================================
- gdcm::FileHelper *copy = new gdcm::FileHelper( );
+ gdcm::FileHelper *copy = gdcm::FileHelper::New( );
copy->SetFileName( output );
copy->Load();
std::cout << std::endl
<< "------------------------------------------------------------"
<< std::endl;
- delete f;
- delete fh;
- delete copy;
+
+ f->Delete();
+ fh->Delete();
+ copy->Delete();
exit (0);
}
Program: gdcm
Module: $RCSfile: exOverlaysACR.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:44 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2005/10/25 14:52:28 $
+ Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//std::cout << argv[1] << std::endl;
- f = new gdcm::File( );
+ f = gdcm::File::New( );
f->SetLoadMode(gdcm::LD_NOSEQ | gdcm::LD_NOSHADOW);
f->SetFileName( fileName );
std::cout << "Sorry, " << fileName <<" not a gdcm-readable "
<< "DICOM / ACR File"
<<std::endl;
- delete f;
+ f->Delete();
return 0;
}
std::cout << " ... is readable " << std::endl;
if ( bitsAllocated <= 8 )
{
std::cout << " 8 bits pixel image cannot contain Overlays " << std::endl;
- delete f;
+ f->Delete();
return 0;
}
std::string s1 = f->GetEntryString(0x6000, 0x0102);
if (s1 == gdcm::GDCM_UNFOUND)
{
std::cout << " Image doesn't contain any Overlay " << std::endl;
- delete f;
+ f->Delete();
return 0;
}
std::cout << " File is read! " << std::endl;
if (fp == 0)
{
std::cout << "Unable to open File" << std::endl;
- delete f;
+ f->Delete();
return 0;
}
else
<< "readable. expected length :" << nx*ny
<< " " << "read length : " << lgt
<< std::endl;
- delete f;
+ f->Delete();
delete pixels;
return 0;
}
gdcm::FileHelper *fh = 0;
-while ( (strOvlBitPosition = f->GetEntryString(currentOvlGroup, 0x0102))
- != gdcm::GDCM_UNFOUND )
-{
+ while ( (strOvlBitPosition = f->GetEntryString(currentOvlGroup, 0x0102))
+ != gdcm::GDCM_UNFOUND )
+ {
strOverlayLocation = f->GetEntryString(currentOvlGroup, 0x0200);
if ( strOverlayLocation != gdcm::GDCM_UNFOUND )
if( gdcm::Debug::GetDebugFlag() )
std::cout << "About to built empty file" << std::endl;
- fileToBuild = new gdcm::File();
+ fileToBuild = gdcm::File::New();
if( gdcm::Debug::GetDebugFlag() )
std::cout << "Finish to built empty file" << std::endl;
if( gdcm::Debug::GetDebugFlag() )
std::cout << "-------------About to built FileHelper" << std::endl;
- fh = new gdcm::FileHelper(fileToBuild);
+ fh = gdcm::FileHelper::New(fileToBuild);
if( gdcm::Debug::GetDebugFlag() )
std::cout << "-------------Finish to built FileHelper" << std::endl;
{
std::cout << "Failed\n"
<< "File in unwrittable\n";
- delete fh;
+ fh->Delete();
if (fileToBuild)
- delete fileToBuild;
+ fileToBuild->Delete();
delete pixels;
delete tabPixels;
return 0;
i++;
}
- delete f;
if (f)
- delete fh;
+ fh->Delete();
if (fileToBuild)
- delete fileToBuild;
+ fileToBuild->Delete();
+ f->Delete();
delete pixels;
delete tabPixels;
+
return 0;
}
Program: gdcm
Module: $RCSfile: exReadPapyrus.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:44 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2005/10/25 14:52:28 $
+ Version: $Revision: 1.5 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
}
int loadMode = 0x0; // load everything
- gdcm::File *f = new gdcm::File();
+ gdcm::File *f = gdcm::File::New();
f->SetLoadMode( loadMode );
f->SetFileName( fileName );
bool res = f->Load();
if ( !res )
{
- delete f;
+ f->Delete();
return 0;
}
if (!seqPapyrus)
{
std::cout << "NOT a Papyrus File : " << fileName <<std::endl;
- delete f;
+ f->Delete();
return 1;
}
{
std::cout << "NO SQItem found within private Papyrus Sequence"
<< std::endl;
- delete f;
+ f->Delete();
return 1;
}
std::string NumberOfFrames = gdcm::Util::Format("%d", nbImages);
- gdcm::File *n = new gdcm::File();
+ gdcm::File *n = gdcm::File::New();
n->InsertEntryString(MediaStSOPinstUID, 0x0002,0x0002);
// Whe keep default gdcm Transfer Syntax (Explicit VR Little Endian)
n->InsertEntryString(PixelRepresentation,0x0028,0x0103);
// create the file
- gdcm::FileHelper *file = new gdcm::FileHelper(n);
+ gdcm::FileHelper *file = gdcm::FileHelper::New(n);
file->SetImageData(PixelArea,lgrImage*nbImages);
file->SetWriteTypeToDcmExplVR();
if (!file)
{
std::cout <<"Fail to open (write) file:[" << outputFileName << "]" << std::endl;;
+ n->Delete();
+ file->Delete();
return 1;
}
+ n->Delete();
+ file->Delete();
return 0;
}
Program: gdcm
Module: $RCSfile: exReadWriteFile.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 12:58:24 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2005/10/25 14:52:28 $
+ Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// First, let's create a gdcm::File
// that will contain all the Dicom fields but the Pixels Element
- gdcm::File *f1= new gdcm::File( );
+ gdcm::File *f1= gdcm::File::New( );
f1->SetFileName( filename );
f1->Load();
// Hope now he knows enought about the image ;-)
// First, create a gdcm::FileHelper
- gdcm::FileHelper *fh1 = new gdcm::FileHelper(f1);
+ gdcm::FileHelper *fh1 = gdcm::FileHelper::New(f1);
// Load the pixels, transforms LUT (if any) into RGB Pixels
uint8_t *imageData = fh1->GetImageData();
// ------ User wants write a new image without shadow groups -------------
- gdcm::FileHelper *copy = new gdcm::FileHelper( );
+ gdcm::FileHelper *copy = gdcm::FileHelper::New( );
copy->SetFileName( output );
copy->Load();
std::cout << std::endl
<< "------------------------------------------------------------"
<< std::endl;
- delete f1;
- delete fh1;
- delete copy;
+ f1->Delete();
+ fh1->Delete();
+ copy->Delete();
exit (0);
}
Program: gdcm
Module: $RCSfile: TestAllReadCompareDicom.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:46 $
- Version: $Revision: 1.48 $
+ Date: $Date: 2005/10/25 14:52:30 $
+ Version: $Revision: 1.49 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
std::cout << "1...";
// new style
- gdcm::File *f = new gdcm::File();
+ gdcm::File *f = gdcm::File::New();
f->SetLoadMode ( gdcm::LD_ALL ); // Load everything
f->SetFileName( filename );
f->Load();
std::cout << " Failed" << std::endl
<< " Image not gdcm compatible:"
<< filename << std::endl;
- delete f;
+ f->Delete();
return 1;
}
- gdcm::FileHelper *tested = new gdcm::FileHelper( f );
+ gdcm::FileHelper *tested = gdcm::FileHelper::New( f );
////// Step 2:
////// Check for existence of reference baseline dicom file:
<< " Image not Testing compatible:"
<< filename << std::endl;
delete reference;
- delete tested;
- delete f;
+ tested->Delete();
+ f->Delete();
return 1;
}
<< "Z: " << tested->GetFile()->GetZSize() << " # "
<< reference->GetZSize() << std::endl;
delete reference;
- delete tested;
- delete f;
+ tested->Delete();
+ f->Delete();
return 1;
}
<< reference->GetNumberOfComponents() << std::endl
<< " Pixel type: " << tested->GetFile()->GetPixelType() << std::endl;
delete reference;
- delete tested;
- delete f;
+ tested->Delete();
+ f->Delete();
return 1;
}
<< tested->GetFile()->GetYSize() << ","
<< tested->GetFile()->GetZSize() << ")"
<< std::endl;
- delete tested;
+ tested->Delete();
delete reference;
- delete f;
+ f->Delete();
return 1;
}
}
std::cout << std::endl;
- delete tested;
+ tested->Delete();
delete reference;
- delete f;
+ f->Delete();
return 1;
}
//////////////// Clean up:
- delete tested;
+ tested->Delete();
delete reference;
- delete f;
+ f->Delete();
std::cout << "OK." << std::endl;
Program: gdcm
Module: $RCSfile: TestAllVM.cxx,v $
Language: C++
- Date: $Date: 2005/10/23 14:53:51 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2005/10/25 14:52:30 $
+ Version: $Revision: 1.8 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
int DoTheVMTest(std::string const &filename)
{
- gdcm::File file;
+ gdcm::File *file = gdcm::File::New();
// - Do not test unknow VM in shadow groups (if element 0x0000 is present)
// - Skip Sequences (if they are 'True Length'); loading will be quicker
// (anyway, Sequences are skipped at processing time ...)
- file.SetLoadMode( gdcm::LD_NOSHADOW | gdcm::LD_NOSEQ );
+ file->SetLoadMode( gdcm::LD_NOSHADOW | gdcm::LD_NOSEQ );
- file.SetFileName( filename );
- if( !file.Load() ) //would be really bad...
+ file->SetFileName( filename );
+ if( !file->Load() ) //would be really bad...
return 1;
- gdcm::DocEntry *d = file.GetFirstEntry();
+ gdcm::DocEntry *d = file->GetFirstEntry();
std::cerr << "Testing file : " << filename << std::endl;
while(d)
{
{
// We skip pb of SQ recursive exploration
}
- d = file.GetNextEntry();
+ d = file->GetNextEntry();
}
- return 0;
+ file->Delete();
+
+ return 0;
}
int TestAllVM(int argc, char *argv[])
Program: gdcm
Module: $RCSfile: TestBug.cxx,v $
Language: C++
- Date: $Date: 2005/07/08 13:39:57 $
- Version: $Revision: 1.20 $
+ Date: $Date: 2005/10/25 14:52:30 $
+ Version: $Revision: 1.21 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
int TestBug(int argc, char *argv[])
{
gdcm::File *f;
- f = new gdcm::File();
+ f = gdcm::File::New();
if (argc > 1)
f->SetFileName( argv[1] );
f->Load( );
f->GetPubDict()->Print();
- delete f;
+ f->Delete();
return 0;
}
Program: gdcm
Module: $RCSfile: TestBuildUpDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/10/25 09:22:13 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2005/10/25 14:52:30 $
+ Version: $Revision: 1.8 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
gdcm::DicomDir *dcmdir;
std::string dirName;
- dcmdir = new gdcm::DicomDir();
+ dcmdir = gdcm::DicomDir::New();
gdcm::DicomDirPatient *p1;
// --- Forget these 4 lines :
<<" is not readable"<<std::endl
<<" ...Failed"<<std::endl;
- delete dcmdir;
+ dcmdir->Delete();
return 1;
}
// Write it on disc
dcmdir->Write("NewDICOMDIR");
- delete dcmdir;
+ dcmdir->Delete();
// Read the newly written DicomDir
- gdcm::DicomDir *newDicomDir = new gdcm::DicomDir();
+ gdcm::DicomDir *newDicomDir = gdcm::DicomDir::New();
newDicomDir->SetFileName("NewDICOMDIR");
newDicomDir->Load( );
if( !newDicomDir->IsReadable() )
<<" is not readable"<<std::endl
<<" ...Failed"<<std::endl;
- delete newDicomDir;
+ newDicomDir->Delete();
return 1;
}
// Check some value we are sure
{
std::cout << "A patient is missing in written DicomDir"
<< std::endl;
- delete newDicomDir;
+ newDicomDir->Delete();
return 1;
}
}
std::cout<<std::flush;
- delete newDicomDir;
+ newDicomDir->Delete();
return errorFound;
}
Program: gdcm
Module: $RCSfile: TestDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:46 $
- Version: $Revision: 1.41 $
+ Date: $Date: 2005/10/25 14:52:30 $
+ Version: $Revision: 1.42 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
file += "/DICOMDIR";
}
- dicomdir = new gdcm::DicomDir( );
+ dicomdir = gdcm::DicomDir::New();
dicomdir->SetFileName(file);
- dicomdir->Load( );
+ dicomdir->Load();
if (argc > 2)
{
int level = atoi(argv[2]);
<<"' is not readable"<<std::endl
<<" ...Failed"<<std::endl;
- delete dicomdir;
+ dicomdir->Delete();
return 1;
}
else
<<" has no patient"<<std::endl
<<" ...Failed"<<std::endl;
- delete dicomdir;
+ dicomdir->Delete();
return 1;
}
<< "NewDICOMDIR written on disc ================================="
<< std::endl<< std::endl;
// Read what we wrote
- gdcm::DicomDir *d2 = new gdcm::DicomDir( );
+ gdcm::DicomDir *d2 = gdcm::DicomDir::New();
d2->SetFileName("NewDICOMDIR");
- d2->Load( );
- if (!d2->IsReadable( ))
+ d2->Load();
+ if (!d2->IsReadable())
{
std::cout << std::endl << std::endl
<< "Read NewDicomDir from disc failed ========================"
if (!d2)
{
std::cout << "NewDICOMDIR contains no Patient ?!?" << std::endl;
- delete dicomdir;
- delete d2;
+ dicomdir->Delete();
+ d2->Delete();
return 1;
}
if ( CompareSQItem(pa2,pa1) == 1 )
{
- delete dicomdir;
- delete d2;
+ dicomdir->Delete();
+ d2->Delete();
return 1;
}
{
if ( CompareSQItem(st2,st1) == 1 )
{
- delete dicomdir;
- delete d2;
+ dicomdir->Delete();
+ d2->Delete();
return 1;
}
while ( se1 && se2 )
{ // we process all the SERIE of this study
if ( CompareSQItem(se2,se1) == 1 )
- return 1;
+ return 1;
+
std::cout << "--- --- " << se2->GetEntryString(0x0008, 0x103e); // Serie Description
std::cout << " Ser.nb:["<< se2->GetEntryString(0x0020, 0x0011); // Series number
std::cout << "] Mod.:[" << se2->GetEntryString(0x0008, 0x0060) << "]" << std::endl; // Modality
{
if ( CompareSQItem(im2,im1) == 1 )
{
- delete dicomdir;
- delete d2;
+ dicomdir->Delete();
+ d2->Delete();
return 1;
}
}
std::cout << std::flush;
- delete dicomdir;
- delete d2;
+ dicomdir->Delete();
+ d2->Delete();
return 0;
}
Program: gdcm
Module: $RCSfile: TestDicomDirElement.cxx,v $
Language: C++
- Date: $Date: 2005/07/08 13:39:57 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2005/10/25 14:52:30 $
+ Version: $Revision: 1.6 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
int TestDicomDirElement(int , char *[])
{
- gdcm::DicomDirElement *ddElt = new gdcm::DicomDirElement();
+ gdcm::DicomDirElement *ddElt = gdcm::DicomDirElement::New();
if (ddElt == 0)
{
- std::cout << "new DicomDirElement failed" << std::endl;
- return 1;
+ std::cout << "new DicomDirElement failed" << std::endl;
+ return 1;
}
ddElt->Print( std::cout );
std::cout << " -------- DicomDirElement After modif --------" <<std::endl;
ddElt->Print( std::cout );
- delete ddElt;
+ ddElt->Delete();
return 0;
}
Program: gdcm
Module: $RCSfile: TestDict.cxx,v $
Language: C++
- Date: $Date: 2005/10/20 15:24:05 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2005/10/25 14:52:30 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
std::cout << "----- Test Default Dicom Dictionary : ----------" << std::endl;
// Just to improve test coverage:
- gdcm::Dict *tempDict = new gdcm::Dict("dummyFileNameThatDoesntExist");
+ gdcm::Dict *tempDict = gdcm::Dict::New("dummyFileNameThatDoesntExist");
// Default dict is supposed to be used.
tempDict->Print();
std::cout << "---- end Test Default Dicom Dictionary : -------" << std::endl;
// Lets delete it.
- delete tempDict;
+ tempDict->Delete();
// Print the DictSet
Program: gdcm
Module: $RCSfile: TestDictGroupName.cxx,v $
Language: C++
- Date: $Date: 2005/07/08 13:39:57 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2005/10/25 14:52:30 $
+ Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <iomanip>
-int CompareDictGroupName(gdcm::DictGroupName &groupName,
+int CompareDictGroupName(gdcm::DictGroupName *groupName,
uint16_t group,std::string ref)
{
- std::string val = groupName.GetName(group);
+ std::string val = groupName->GetName(group);
std::cout << "Group : 0x" << std::hex << std::setw(4) << group
<< std::dec << " : " << val << " - "
<< (bool)(val==ref) << std::endl;
int TestDictGroupName(int , char *[])
{
- gdcm::DictGroupName groupName;
- groupName.Print( std::cout );
+ gdcm::DictGroupName *groupName = gdcm::DictGroupName::New();
+ groupName->Print( std::cout );
int ret = 0;
ret += CompareDictGroupName(groupName,0x7fe0,"Pixels");
ret += CompareDictGroupName(groupName,0x0007,gdcm::GDCM_UNFOUND);
+ groupName->Delete();
+
return ret;
}
Program: gdcm
Module: $RCSfile: TestFileAccessors.cxx,v $
Language: C++
- Date: $Date: 2005/10/20 08:58:15 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2005/10/25 14:52:31 $
+ Version: $Revision: 1.5 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
catch(...) \
{ \
std::cout << " --> Can't access to the '" << #name << "' method !" << std::endl; \
- delete f; \
+ f->Delete(); \
return 1; \
}
filename += gdcmDataImages[i];
std::cout << "Begin with " << filename << std::endl;
- gdcm::File *f= new gdcm::File( );
+ gdcm::File *f= gdcm::File::New( );
f->SetFileName( filename );
f->Load( );
{
std::cout << " " << filename << " is Readable" << std::endl;
- gdcm::FileHelper *fh= new gdcm::FileHelper( f );
+ gdcm::FileHelper *fh= gdcm::FileHelper::New( f );
TestMethodMacro(std::dec,fh,GetImageDataSize)
TestMethodMacro(std::dec,fh,GetImageDataRawSize)
TestMethodMacro(std::dec,fh,GetUserDataSize)
TestMethodMacro(std::dec,fh,GetWriteType)
- delete fh;
+ fh->Delete();
}
else
{
std::cout << filename << " is NOT Readable"
<< std::endl << std::endl;
- delete f;
+ f->Delete();
return 1;
}
- delete f;
+ f->Delete();
std::cout << "End with " << filename << std::endl;
i++;
}
Program: gdcm
Module: $RCSfile: TestImageSet.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:46 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2005/10/25 14:52:31 $
+ Version: $Revision: 1.6 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
FileList::iterator it;
for(it=list.begin();it!=list.end();++it)
{
- delete (*it);
+ (*it)->Delete();
}
list.clear();
}
memset(imageData,0,size);
// Write the image
- gdcm::FileHelper *hlp = new gdcm::FileHelper(file);
+ gdcm::FileHelper *hlp = gdcm::FileHelper::New(file);
hlp->SetImageData(imageData,size);
hlp->SetWriteTypeToDcmExplVR();
if( !hlp->Write(fileName) )
std::cout << "Failed\n"
<< " File in unwrittable\n";
- delete hlp;
+ hlp->Delete();
delete[] imageData;
return NULL;
}
delete[] imageData;
- delete hlp;
+ hlp->Delete();
// Read the written image
- gdcm::File *reread = new gdcm::File( );
+ gdcm::File *reread = gdcm::File::New( );
reread->SetFileName( fileName );
reread->Load();
if( !reread->IsReadable() )
{
std::cerr << "Failed" << std::endl
<< " Could not reread written image :" << fileName << std::endl;
- delete reread;
+ reread->Delete();
return NULL;
}
{
std::ostringstream fileName;
fileName << "FileSeq" << i << ".dcm";
- file = new gdcm::File();
+ file = gdcm::File::New();
// It's up to the user to initialize Serie UID and Study UID
// Study Instance UID
studyUID = gdcm::Util::CreateUniqueUID();
newFile = WriteImage(file, fileName.str());
if( !newFile )
{
- delete file;
+ file->Delete();
return 1;
}
else
fileList.push_back(newFile);
- delete file;
+ file->Delete();
}
if( CompareImages(fileList, false, false) )
{
std::ostringstream fileName;
fileName << "FileSeq" << i << ".dcm";
- file = new gdcm::File();
+ file = gdcm::File::New();
file->InsertEntryString(studyUID, 0x0020, 0x000d);
file->InsertEntryString(serieUID, 0x0020, 0x000e);
newFile = WriteImage(file, fileName.str());
if( !newFile )
{
- delete file;
+ file->Delete();
return(1);
}
else
fileList.push_back(newFile);
- delete file;
+ file->Delete();
}
if( CompareImages(fileList, true, true) )
{
std::ostringstream fileName;
fileName << "FileSeq" << i << ".dcm";
- file = new gdcm::File();
+ file = gdcm::File::New();
file->InsertEntryString(studyUID, 0x0020, 0x000d);
serieUID = gdcm::Util::CreateUniqueUID();
file->InsertEntryString(serieUID, 0x0020, 0x000e);
newFile = WriteImage(file, fileName.str());
if( !newFile )
{
- delete file;
+ file->Delete();
return(1);
}
else
fileList.push_back(newFile);
- delete file;
+ file->Delete();
}
if( CompareImages(fileList, false, true) )
Program: gdcm
Module: $RCSfile: TestLoadAllDocumentsNoPrivNoSeq.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:46 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2005/10/25 14:52:31 $
+ Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
filename += "/"; //doh!
filename += gdcmDataImages[i];
- gdcm::File *f= new gdcm::File( );
+ gdcm::File *f= gdcm::File::New( );
f->SetFileName( filename );
// just to improve coverage
f->SetLoadMode (gdcm::LD_NOSEQ|gdcm::LD_NOSHADOW);
{
std::cout << filename << " is NOT Readable"
<< std::endl << std::endl;
- delete f;
+ f->Delete();
return 1;
}
*/
- delete f;
+ f->Delete();
i++;
}
return 0;
Program: gdcm
Module: $RCSfile: TestMakeDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/08/31 09:29:11 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2005/10/25 14:52:31 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
gdcm::DicomDir *dcmdir;
// new style (user is allowed no to load Sequences an/or Shadow Groups)
- dcmdir = new gdcm::DicomDir( );
+ dcmdir = gdcm::DicomDir::New( );
// dcmdir->SetLoadMode(gdcm::LD_NOSEQ | gdcm::LD_NOSHADOW);
// some images have a wrong length for element 0x0000 of private groups
std::cout << "makeDicomDir: no patient found. Exiting."
<< std::endl;
- delete dcmdir;
+ dcmdir->Delete();
return 1;
}
// Create the corresponding DicomDir
dcmdir->Write("NewDICOMDIR");
- delete dcmdir;
+ dcmdir->Delete();
// Read from disc the just written DicomDir
- gdcm::DicomDir *newDicomDir = new gdcm::DicomDir();
+ gdcm::DicomDir *newDicomDir = gdcm::DicomDir::New();
newDicomDir->SetFileName("NewDICOMDIR");
newDicomDir->Load();
<<" is not readable"<<std::endl
<<" ...Failed"<<std::endl;
- delete newDicomDir;
+ newDicomDir->Delete();
return 1;
}
<<" has no patient"<<std::endl
<<" ...Failed"<<std::endl;
- delete newDicomDir;
+ newDicomDir->Delete();
return(1);
}
std::cout<<std::flush;
- delete newDicomDir;
+ newDicomDir->Delete();
return 0;
}
Program: gdcm
Module: $RCSfile: TestMakeIcon.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:46 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2005/10/25 14:52:31 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
<< " input filename.dcm output Filename.dcm" << std::endl;
}
- gdcm::File *f = new gdcm::File( );
+ gdcm::File *f = gdcm::File::New( );
f->SetFileName( input );
f->Load( );
if ( ! f->IsReadable() )
{
std::cout << " Failed to Open/Parse file" << input << std::endl;
- delete f;
+ f->Delete();
return 1;
}
- gdcm::FileHelper *fh = new gdcm::FileHelper(f);
+ gdcm::FileHelper *fh = gdcm::FileHelper::New(f);
uint8_t *pixels = fh->GetImageData();
uint32_t lgth = fh->GetImageDataSize();
gdcm::SeqEntry *icon = f->InsertSeqEntry(0x0088, 0x0200);
- gdcm::SQItem *sqi = new gdcm::SQItem(1);
+ gdcm::SQItem *sqi = gdcm::SQItem::New(1);
icon->AddSQItem(sqi, 1);
+ sqi->Delete();
// icone is just define like the image
// The purpose is NOT to imagine an icon,
fh->WriteDcmExplVR(output);
- delete f;
+ f->Delete();
+ fh->Delete();
- f = new gdcm::File();
+ f = gdcm::File::New();
f->SetFileName(output);
f->Load();
f->Print();
{
std::cout << "Sequence 0088|0200 not found" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
std::cout << "Sequence 0088|0200 found" << std::endl;
{
std::cout << "Sequence 0088|0200 has no SQItem" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
{
std::cout << "GetDataEntry 0028|0010 not found" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
std::cout << "First Item ->DataEntry 0028|0010 found" << std::endl;
<< "Read : " << sqi->GetDataEntry(0x0028,0x0010)->GetString()
<< " - Expected : 128" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
{
std::cout << "GetDataEntry 0028|0011 not found" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
std::cout << "First Item ->DataEntry 0028|0011 found" << std::endl;
<< "Read : " << sqi->GetDataEntry(0x0028,0x0011)->GetString()
<< " - Expected : 128" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
{
std::cout << "GetDataEntry 0028|0100 not found" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
std::cout << "First Item ->DataEntry 0028|0100 found" << std::endl;
<< "Read : " << sqi->GetDataEntry(0x0028,0x0100)->GetString()
<< " - Expected : 8" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
{
std::cout << "GetDataEntry 0028|0101 not found" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
std::cout << "First Item ->DataEntry 0028|0101 found" << std::endl;
<< "Read : " << sqi->GetDataEntry(0x0028,0x0101)->GetString()
<< " - Expected : 8" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
{
std::cout << "DataEntry 0028|0102 not found" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
std::cout << "First Item ->DataEntry 0028|0102 found" << std::endl;
<< "Read : " << sqi->GetDataEntry(0x0028,0x0102)->GetString()
<< " - Expected : 7" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
{
std::cout << "GetDataEntry 0028|0010 not found" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
std::cout << "First Item ->DataEntry 0028|0103 found" << std::endl;
<< "Read : " << sqi->GetDataEntry(0x0028,0x0103)->GetString()
<< " - Expected : 0" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
{
std::cout << "GetDataEntry 0005|0010 not found" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
std::cout << "First Item ->GetDataEntry 0005|0010 found" << std::endl;
<< "Read : " << sqi->GetDataEntry(0x0005,0x0010)->GetLength()
<< " - Expected : 6" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
{
std::cout << "Value 0005|0010 don't match (DataEntry)" << std::endl
<< " ... Failed" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
return 1;
}
std::cout << "Value DataEntry 0005|0010 OK" << std::endl;
- delete fh;
- delete f;
+ f->Delete();
std::cout << " ... OK" << std::endl;
return 0;
Program: gdcm
Module: $RCSfile: TestPrintAllDocument.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:46 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2005/10/25 14:52:31 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
filename += "/"; //doh!
filename += gdcmDataImages[i];
- gdcm::File *f= new gdcm::File( );
+ gdcm::File *f= gdcm::File::New( );
f->SetFileName( filename );
f->Load();
{
std::cout << filename << " is NOT Readable"
<< std::endl << std::endl;
- delete f;
+ f->Delete();
return 1;
}
- delete f;
+ f->Delete();
i++;
}
return 0;
Program: gdcm
Module: $RCSfile: TestReadWriteReadCompare.cxx,v $
Language: C++
- Date: $Date: 2005/10/19 13:15:37 $
- Version: $Revision: 1.26 $
+ Date: $Date: 2005/10/25 14:52:31 $
+ Version: $Revision: 1.27 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//////////////// Step 1 (see above description):
- gdcm::File *file = new gdcm::File( );
+ gdcm::File *file = gdcm::File::New( );
file->SetFileName( filename );
file->Load ();
if( !file->IsReadable() )
std::cout << "Failed" << std::endl
<< "Test::TestReadWriteReadCompare: Image not gdcm compatible:"
<< filename << std::endl;
- delete file;
+ file->Delete();
return 1;
}
std::cout << " step 1...";
//////////////// Step 2:
- gdcm::FileHelper *filehelper = new gdcm::FileHelper( file );
+ gdcm::FileHelper *filehelper = gdcm::FileHelper::New( file );
int dataSize = filehelper->GetImageDataSize();
uint8_t *imageData = filehelper->GetImageData(); //EXTREMELY IMPORTANT
// Sure, it is : It's up to the user to decide if he wants to
std::cout << "2...";
//////////////// Step 3:
- gdcm::File *fileout = new gdcm::File();
+ gdcm::File *fileout = gdcm::File::New();
fileout->SetFileName( output );
fileout->Load();
// gdcm::FileHelper *reread = new gdcm::FileHelper( output ); // deprecated
std::cout << "Failed" << std::endl
<< "Test::TestReadWriteReadCompare: Could not parse the newly "
<< "written image:" << filename << std::endl;
- delete file;
- delete filehelper;
- delete fileout;
+ file->Delete();
+ filehelper->Delete();
+ fileout->Delete();
return 1;
}
- gdcm::FileHelper *reread = new gdcm::FileHelper( fileout );
+ gdcm::FileHelper *reread = gdcm::FileHelper::New( fileout );
std::cout << "3...";
// For the next step:
<< reread->GetFile()->GetYSize() << " | "
<< "Z: " << file->GetZSize() << " # "
<< reread->GetFile()->GetZSize() << std::endl;
- delete file;
- delete filehelper;
- delete fileout;
- delete reread;
+ file->Delete();
+ filehelper->Delete();
+ fileout->Delete();
+ reread->Delete();
return 1;
}
std::cout << "Failed" << std::endl
<< " Pixel areas lengths differ: "
<< dataSize << " # " << dataSizeWritten << std::endl;
- delete file;
- delete filehelper;
- delete fileout;
- delete reread;
+ file->Delete();
+ filehelper->Delete();
+ fileout->Delete();
+ reread->Delete();
return 1;
}
{
std::cout << "Failed" << std::endl
<< " Pixel differ (as expanded in memory)." << std::endl;
- delete file;
- delete filehelper;
- delete fileout;
- delete reread;
+ file->Delete();
+ filehelper->Delete();
+ fileout->Delete();
+ reread->Delete();
return 1;
}
std::cout << "4...OK." << std::endl ;
//////////////// Clean up:
- delete file;
- delete filehelper;
- delete fileout;
- delete reread;
+ file->Delete();
+ filehelper->Delete();
+ fileout->Delete();
+ reread->Delete();
return 0;
}
Program: gdcm
Module: $RCSfile: TestTS.cxx,v $
Language: C++
- Date: $Date: 2005/02/02 10:05:26 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2005/10/25 14:52:31 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
int TestTS(int , char *[])
{
- gdcm::TS ts;
+ gdcm::TS *ts = gdcm::TS::New();
// There should be ~150 entries
- ts.Print( std::cout );
+ ts->Print( std::cout );
// Implicit VR Little Endian
- std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2" ) << std::endl;
// Implicit VR Big Endian DLX (G.E Private)
- std::cout << ts.IsTransferSyntax( "1.2.840.113619.5.2" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.113619.5.2" ) << std::endl;
// Explicit VR Little Endian
- std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.1" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.1" ) << std::endl;
// Deflated Explicit VR Little Endian
- std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.1.99" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.1.99" ) << std::endl;
// Explicit VR Big Endian
- std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.2" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.2" ) << std::endl;
// JPEG Baseline (Process 1)
- std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.50" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.50" ) << std::endl;
// JPEG Extended (Process 2 & 4)
- std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.51" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.51" ) << std::endl;
// JPEG Extended (Process 3 & 5)
- std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.52" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.52" ) << std::endl;
// JPEG Spectral Selection, Non-Hierarchical (Process 6 & 8)
- std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.53" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.53" ) << std::endl;
// JPEG Full Progression, Non-Hierarchical (Process 10 & 12)
- std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.55" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.55" ) << std::endl;
// JPEG Lossless, Non-Hierarchical (Process 14)
- std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.57" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.57" ) << std::endl;
// JPEG Lossless, Hierarchical, First-Order Prediction (Process 14,
// [Selection Value 1])
- std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.70" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.70" ) << std::endl;
// JPEG 2000 Lossless
- std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.90" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.90" ) << std::endl;
// JPEG 2000
- std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.4.91" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.91" ) << std::endl;
// RLE Lossless
- std::cout << ts.IsTransferSyntax( "1.2.840.10008.1.2.5" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.5" ) << std::endl;
// Unknown
- std::cout << ts.IsTransferSyntax( "Unknown Transfer Syntax" ) << std::endl;
+ std::cout << ts->IsTransferSyntax( "Unknown Transfer Syntax" ) << std::endl;
// Test JPEG test:
std::cout << "Test TS:" << std::endl;
- std::cout << ts.IsJPEGLossless( "1.2.840.10008.1.2.4.55") << std::endl;
+ std::cout << ts->IsJPEGLossless( "1.2.840.10008.1.2.4.55") << std::endl;
//if ( key == "1.2.840.10008.1.2.4.55"
// || key == "1.2.840.10008.1.2.4.57"
// || key == "1.2.840.10008.1.2.4.70" )
- std::cout << ts.IsRLELossless( "1.2.840.10008.1.2.5") << std::endl;
- std::cout << ts.IsJPEGLossless( "1.2.840.10008.1.2.5") << std::endl;
- std::cout << ts.IsJPEG2000( "1.2.840.10008.1.2.5") << std::endl;
- std::cout << ts.IsJPEG( "1.2.840.10008.1.2.5") << std::endl;
- std::cout << ts.GetSpecialTransferSyntax(
- ts.GetSpecialTransferSyntax( "1.2.840.10008.1.2.5")) << std::endl;
+ std::cout << ts->IsRLELossless( "1.2.840.10008.1.2.5") << std::endl;
+ std::cout << ts->IsJPEGLossless( "1.2.840.10008.1.2.5") << std::endl;
+ std::cout << ts->IsJPEG2000( "1.2.840.10008.1.2.5") << std::endl;
+ std::cout << ts->IsJPEG( "1.2.840.10008.1.2.5") << std::endl;
+ std::cout << ts->GetSpecialTransferSyntax(
+ ts->GetSpecialTransferSyntax( "1.2.840.10008.1.2.5")) << std::endl;
std::cout << gdcm::Global::GetTS()->IsRLELossless( "1.2.840.10008.1.2.5" )
<< std::endl;
- return ts.GetValue( "" ) != gdcm::GDCM_UNFOUND;
+ bool ret = ts->GetValue( "" ) != gdcm::GDCM_UNFOUND;
+
+ ts->Delete();
+
+ return ret;
}
Program: gdcm
Module: $RCSfile: TestVR.cxx,v $
Language: C++
- Date: $Date: 2005/10/21 08:28:02 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2005/10/25 14:52:31 $
+ Version: $Revision: 1.11 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
int TestVR(int , char *[])
{
int error = 0;
- gdcm::VR *vr = new gdcm::VR();
+ gdcm::VR *vr = gdcm::VR::New();
gdcm::Debug::DebugOn();
error++;
}
- delete vr;
+ vr->Delete();
return error;
}
Program: gdcm
Module: $RCSfile: TestWriteSimple.cxx,v $
Language: C++
- Date: $Date: 2005/10/21 08:34:26 $
- Version: $Revision: 1.41 $
+ Date: $Date: 2005/10/25 14:52:31 $
+ Version: $Revision: 1.42 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// Step 1 : Create the header of the image
std::cout << " 1...";
- gdcm::File *fileToBuild = new gdcm::File();
+ gdcm::File *fileToBuild = gdcm::File::New();
std::ostringstream str;
// Set the image size
// Step 3 : Create the file of the image
std::cout << "3...";
- gdcm::FileHelper *fileH = new gdcm::FileHelper(fileToBuild);
+ gdcm::FileHelper *fileH = gdcm::FileHelper::New(fileToBuild);
fileH->SetImageData(imageData,size);
// Step 4 : Set the writting mode and write the image
std::cout << "Failed for [" << fileName.str() << "]\n"
<< " Write mode '"<<img.writeMode<<"' is undefined\n";
- delete fileH;
- delete fileToBuild;
+ fileH->Delete();
+ fileToBuild->Delete();
delete[] imageData;
return 1;
}
std::cout << "Failed for [" << fileName.str() << "]\n"
<< " File is unwrittable\n";
- delete fileH;
- delete fileToBuild;
+ fileH->Delete();
+ fileToBuild->Delete();
delete[] imageData;
return 1;
}
// old form.
//gdcm::FileHelper *reread = new gdcm::FileHelper( fileName.str() );
// Better use :
- gdcm::FileHelper *reread = new gdcm::FileHelper( );
+ gdcm::FileHelper *reread = gdcm::FileHelper::New( );
reread->SetFileName( fileName.str() );
reread->SetLoadMode(gdcm::LD_ALL); // Load everything
// Possible values are
{
std::cerr << "Failed" << std::endl
<< "Could not read written image : " << fileName.str() << std::endl;
- delete fileToBuild;
- delete fileH;
- delete reread;
+ fileToBuild->Delete();
+ fileH->Delete();
+ reread->Delete();
delete[] imageData;
return 1;
}
<< " File type differ: "
<< fileH->GetWriteType() << " # "
<< reread->GetFile()->GetFileType() << std::endl;
- delete fileToBuild;
- delete fileH;
- delete reread;
+ fileToBuild->Delete();
+ fileH->Delete();
+ reread->Delete();
delete[] imageData;
return 1;
<< reread->GetFile()->GetYSize() << " | "
<< "Z: " << fileToBuild->GetZSize() << " # "
<< reread->GetFile()->GetZSize() << std::endl;
- delete fileToBuild;
- delete fileH;
- delete reread;
+ fileToBuild->Delete();
+ fileH->Delete();
+ reread->Delete();
delete[] imageData;
return 1;
std::cout << "Failed" << std::endl
<< " Pixel areas lengths differ: "
<< size << " # " << dataSizeWritten << std::endl;
- delete fileToBuild;
- delete fileH;
- delete reread;
+ fileToBuild->Delete();
+ fileH->Delete();
+ reread->Delete();
delete[] imageData;
return 1;
}
}
std::cout << std::endl;
- delete fileToBuild;
- delete fileH;
- delete reread;
+ fileToBuild->Delete();
+ fileH->Delete();
+ reread->Delete();
delete[] imageData;
return 1;
std::cout << "OK" << std::endl;
- delete fileToBuild;
- delete fileH;
- delete reread;
+ fileToBuild->Delete();
+ fileH->Delete();
+ reread->Delete();
delete[] imageData;
return 0;
Program: gdcm
Module: $RCSfile: gdcmDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/10/25 09:22:15 $
- Version: $Revision: 1.166 $
+ Date: $Date: 2005/10/25 14:52:33 $
+ Version: $Revision: 1.167 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
NewMeta();
}
-#ifndef GDCM_LEGACY_REMOVE
-/* *
- * \ brief Constructor Parses recursively the directory and creates the DicomDir
- * or uses an already built DICOMDIR, depending on 'parseDir' value.
- * @ param fileName name
- * - of the root directory (parseDir = true)
- * - of the DICOMDIR (parseDir = false)
- * @ param parseDir boolean
- * - true if user passed an entry point
- * and wants to explore recursively the directories
- * - false if user passed an already built DICOMDIR file
- * and wants to use it
- * @ deprecated use : new DicomDir() + [ SetLoadMode(lm) + ] SetDirectoryName(name)
- * or : new DicomDir() + SetFileName(name)
- */
-DicomDir::DicomDir(std::string const &fileName, bool parseDir ):
- Document( )
-{
- // At this step, Document constructor is already executed,
- // whatever user passed (either a root directory or a DICOMDIR)
- // and whatever the value of parseDir was.
- // (nothing is cheked in Document constructor, to avoid overhead)
-
- ParseDir = parseDir;
- SetLoadMode (LD_ALL); // concerns only dicom files
- SetFileName( fileName );
- Load( );
-}
-#endif
-
/**
* \brief Canonical destructor
*/
ClearPatient();
if ( MetaElems )
{
- delete MetaElems;
+ MetaElems->Delete();
}
}
DicomDirMeta *DicomDir::NewMeta()
{
if ( MetaElems )
- delete MetaElems;
+ MetaElems->Delete();
DocEntry *entry = GetFirstEntry();
if ( entry )
{
- MetaElems = new DicomDirMeta(true); // true = empty
+ MetaElems = DicomDirMeta::New(true); // true = empty
entry = GetFirstEntry();
while( entry )
}
else // after root directory parsing
{
- MetaElems = new DicomDirMeta(false); // false = not empty
+ MetaElems = DicomDirMeta::New(false); // false = not empty
}
MetaElems->SetSQItemNumber(0); // To avoid further missprinting
return MetaElems;
*/
DicomDirPatient *DicomDir::NewPatient()
{
- DicomDirPatient *p = new DicomDirPatient();
- AddPatientToEnd( p );
- return p;
+ DicomDirPatient *dd = DicomDirPatient::New();
+ AddPatientToEnd( dd );
+ return dd;
}
/**
cc!= Patients.end();
++cc)
{
- delete *cc;
+ (*cc)->Unregister();
}
Patients.clear();
}
break;
}
- f = new File( );
+ f = File::New( );
f->SetLoadMode(LoadMode); // we allow user not to load Sequences, or Shadow
// groups, or ......
f->SetFileName( it->c_str() );
- /*int res = */f->Load( );
+ f->Load( );
-// if ( !f )
-// {
-// gdcmWarningMacro( "Failure in new gdcm::File " << it->c_str() );
-// continue;
-// }
-
if ( f->IsReadable() )
{
// Add the file to the chained list:
}
else
{
- delete f;
+ f->Delete();
}
count++;
}
itDoc!=list.end();
++itDoc)
{
- delete dynamic_cast<File *>(*itDoc);
+ dynamic_cast<File *>(*itDoc)->Delete();
}
}
if ( v == "IMAGE " )
{
- si = new DicomDirImage(true);
+ si = DicomDirImage::New(true);
if ( !AddImageToEnd( static_cast<DicomDirImage *>(si)) )
{
- delete si;
+ si->Delete();
si = NULL;
gdcmErrorMacro( "Add AddImageToEnd failed");
}
}
else if ( v == "SERIES" )
{
- si = new DicomDirSerie(true);
+ si = DicomDirSerie::New(true);
if ( !AddSerieToEnd( static_cast<DicomDirSerie *>(si)) )
{
- delete si;
+ si->Delete();
si = NULL;
gdcmErrorMacro( "Add AddSerieToEnd failed");
}
}
else if ( v == "VISIT " )
{
- si = new DicomDirVisit(true);
+ si = DicomDirVisit::New(true);
if ( !AddVisitToEnd( static_cast<DicomDirVisit *>(si)) )
{
- delete si;
+ si->Delete();
si = NULL;
gdcmErrorMacro( "Add AddVisitToEnd failed");
}
}
else if ( v == "STUDY " )
{
- si = new DicomDirStudy(true);
+ si = DicomDirStudy::New(true);
if ( !AddStudyToEnd( static_cast<DicomDirStudy *>(si)) )
{
- delete si;
+ si->Delete();
si = NULL;
gdcmErrorMacro( "Add AddStudyToEnd failed");
}
}
else if ( v == "PATIENT " )
{
- si = new DicomDirPatient(true);
+ si = DicomDirPatient::New(true);
if ( !AddPatientToEnd( static_cast<DicomDirPatient *>(si)) )
{
- delete si;
+ si->Delete();
si = NULL;
gdcmErrorMacro( "Add PatientToEnd failed");
}
{
case GDCM_DICOMDIR_IMAGE:
elemList = Global::GetDicomDirElements()->GetDicomDirImageElements();
- si = new DicomDirImage(true);
+ si = DicomDirImage::New(true);
if ( !AddImageToEnd(static_cast<DicomDirImage *>(si)) )
{
- delete si;
+ si->Delete();
gdcmErrorMacro( "Add ImageToEnd failed");
}
break;
case GDCM_DICOMDIR_SERIE:
elemList = Global::GetDicomDirElements()->GetDicomDirSerieElements();
- si = new DicomDirSerie(true);
+ si = DicomDirSerie::New(true);
if ( !AddSerieToEnd(static_cast<DicomDirSerie *>(si)) )
{
- delete si;
+ si->Delete();
gdcmErrorMacro( "Add SerieToEnd failed");
}
break;
case GDCM_DICOMDIR_STUDY:
elemList = Global::GetDicomDirElements()->GetDicomDirStudyElements();
- si = new DicomDirStudy(true);
+ si = DicomDirStudy::New(true);
if ( !AddStudyToEnd(static_cast<DicomDirStudy *>(si)) )
{
- delete si;
+ si->Delete();
gdcmErrorMacro( "Add StudyToEnd failed");
}
break;
case GDCM_DICOMDIR_PATIENT:
elemList = Global::GetDicomDirElements()->GetDicomDirPatientElements();
- si = new DicomDirPatient(true);
+ si = DicomDirPatient::New(true);
if ( !AddPatientToEnd(static_cast<DicomDirPatient *>(si)) )
{
- delete si;
+ si->Delete();
gdcmErrorMacro( "Add PatientToEnd failed");
}
break;
case GDCM_DICOMDIR_META:
if ( MetaElems )
{
- delete MetaElems;
+ MetaElems->Delete();
gdcmErrorMacro( "MetaElements already exist, they will be destroyed");
}
elemList = Global::GetDicomDirElements()->GetDicomDirMetaElements();
- MetaElems = new DicomDirMeta(true);
+ MetaElems = DicomDirMeta::New(true);
si = MetaElems;
break;
default:
Program: gdcm
Module: $RCSfile: gdcmDicomDir.h,v $
Language: C++
- Date: $Date: 2005/08/31 09:29:12 $
- Version: $Revision: 1.68 $
+ Date: $Date: 2005/10/25 14:52:33 $
+ Version: $Revision: 1.69 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
class GDCM_EXPORT DicomDir: public Document
{
+ gdcmTypeMacro(DicomDir);
+
public:
- typedef void Method(void*);
+ static DicomDir *New() {return new DicomDir();}
- DicomDir();
- GDCM_LEGACY( DicomDir(std::string const &filename, bool parseDir = false) );
- ~DicomDir();
+ typedef void Method(void*);
GDCM_LEGACY( bool Load(std::string const &filename) );
bool Load( );
} DicomDirType;
protected:
+ DicomDir();
+ ~DicomDir();
+
void CreateDicomDirChainedList(std::string const &path);
void CallStartMethod();
void CallProgressMethod();
Program: gdcm
Module: $RCSfile: gdcmDicomDirElement.h,v $
Language: C++
- Date: $Date: 2005/10/19 12:01:50 $
- Version: $Revision: 1.32 $
+ Date: $Date: 2005/10/25 14:52:33 $
+ Version: $Revision: 1.33 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMDICOMDIRELEMENT_H
#define GDCMDICOMDIRELEMENT_H
-#include "gdcmCommon.h"
+#include "gdcmRefCounter.h"
#include <list>
* \brief Represents elements contained in a DicomDir class
* for the chained lists from the file 'Dicts/DicomDir.dic'
*/
-class GDCM_EXPORT DicomDirElement
+class GDCM_EXPORT DicomDirElement : public RefCounter
{
+ gdcmTypeMacro(DicomDirElement);
+
public:
- DicomDirElement();
- ~DicomDirElement();
+ static DicomDirElement *New() {return new DicomDirElement();}
- /**
+ /**
* \brief canonical Printer
*/
void Print(std::ostream &os);
void AddDicomDirElement(DicomDirType type,
uint16_t group, uint16_t elem);
+protected:
+ DicomDirElement();
+ ~DicomDirElement();
+
private:
/// Elements chained list, related to the MetaElements of DICOMDIR
ListDicomDirMetaElem DicomDirMetaList;
Program: gdcm
Module: $RCSfile: gdcmDicomDirImage.h,v $
Language: C++
- Date: $Date: 2005/02/01 13:11:49 $
- Version: $Revision: 1.16 $
+ Date: $Date: 2005/10/25 14:52:33 $
+ Version: $Revision: 1.17 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
class GDCM_EXPORT DicomDirImage : public DicomDirObject
{
+ gdcmTypeMacro(DicomDirImage);
+
public:
- DicomDirImage(bool empty=false);
- ~DicomDirImage();
+ static DicomDirImage *New(bool empty=false) {return new DicomDirImage(empty);}
void Print(std::ostream &os = std::cout, std::string const &indent = "" );
+
+protected:
+ DicomDirImage(bool empty=false);
+ ~DicomDirImage();
};
} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDicomDirMeta.h,v $
Language: C++
- Date: $Date: 2005/02/01 13:11:49 $
- Version: $Revision: 1.18 $
+ Date: $Date: 2005/10/25 14:52:33 $
+ Version: $Revision: 1.19 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
class GDCM_EXPORT DicomDirMeta : public DicomDirObject
{
+ gdcmTypeMacro(DicomDirMeta);
+
public:
- DicomDirMeta(bool empty=false);
- ~DicomDirMeta();
+ static DicomDirMeta *New(bool empty=false) {return new DicomDirMeta(empty);}
virtual void Print(std::ostream &os = std::cout, std::string const &indent = "" );
virtual void WriteContent(std::ofstream *fp, FileType t);
+
+protected:
+ DicomDirMeta(bool empty=false);
+ ~DicomDirMeta();
};
} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDicomDirObject.h,v $
Language: C++
- Date: $Date: 2005/07/12 17:08:12 $
- Version: $Revision: 1.17 $
+ Date: $Date: 2005/10/25 14:52:33 $
+ Version: $Revision: 1.18 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
class GDCM_EXPORT DicomDirObject : public SQItem
{
+ gdcmTypeMacro(DicomDirObject);
+
public:
protected:
Program: gdcm
Module: $RCSfile: gdcmDicomDirPatient.cxx,v $
Language: C++
- Date: $Date: 2005/06/24 10:55:58 $
- Version: $Revision: 1.38 $
+ Date: $Date: 2005/10/25 14:52:33 $
+ Version: $Revision: 1.39 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
DicomDirStudy* DicomDirPatient::NewStudy()
{
- DicomDirStudy *st = new DicomDirStudy();
- Studies.push_back(st);
- return st;
+ DicomDirStudy *dd = DicomDirStudy::New();
+ Studies.push_back(dd);
+ return dd;
}
/**
cc != Studies.end();
++cc )
{
- delete *cc;
+ (*cc)->Delete();
}
Studies.clear();
}
Program: gdcm
Module: $RCSfile: gdcmDicomDirPatient.h,v $
Language: C++
- Date: $Date: 2005/09/02 07:10:03 $
- Version: $Revision: 1.27 $
+ Date: $Date: 2005/10/25 14:52:33 $
+ Version: $Revision: 1.28 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
class GDCM_EXPORT DicomDirPatient : public DicomDirObject
{
+ gdcmTypeMacro(DicomDirPatient);
+
public:
- DicomDirPatient(bool empty=false);
- ~DicomDirPatient();
+ static DicomDirPatient *New(bool empty=false) {return new DicomDirPatient(empty);}
void Print(std::ostream &os = std::cout, std::string const &indent = "" );
void WriteContent(std::ofstream *fp, FileType t);
DicomDirStudy *GetNextStudy();
DicomDirStudy *GetLastStudy();
-private:
+protected:
+ DicomDirPatient(bool empty=false);
+ ~DicomDirPatient();
+private:
/// chained list of DicomDirStudy (to be exploited hierarchicaly)
ListDicomDirStudy Studies;
/// iterator on the DicomDirStudies of the current DicomDirPatient
Program: gdcm
Module: $RCSfile: gdcmDicomDirSerie.cxx,v $
Language: C++
- Date: $Date: 2005/06/24 10:55:58 $
- Version: $Revision: 1.38 $
+ Date: $Date: 2005/10/25 14:52:33 $
+ Version: $Revision: 1.39 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
DicomDirImage *DicomDirSerie::NewImage()
{
- DicomDirImage *st = new DicomDirImage();
- Images.push_back(st);
- return st;
+ DicomDirImage *dd = DicomDirImage::New();
+ Images.push_back(dd);
+ return dd;
}
/**
cc != Images.end();
++cc)
{
- delete *cc;
+ (*cc)->Delete();
}
Images.clear();
}
Program: gdcm
Module: $RCSfile: gdcmDicomDirSerie.h,v $
Language: C++
- Date: $Date: 2005/09/02 07:10:03 $
- Version: $Revision: 1.29 $
+ Date: $Date: 2005/10/25 14:52:33 $
+ Version: $Revision: 1.30 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
class GDCM_EXPORT DicomDirSerie : public DicomDirObject
{
+ gdcmTypeMacro(DicomDirSerie);
+
public:
- DicomDirSerie(bool empty=false);
- ~DicomDirSerie();
+ static DicomDirSerie *New(bool empty=false) {return new DicomDirSerie(empty);}
void Print( std::ostream &os = std::cout, std::string const &indent = "" );
void WriteContent( std::ofstream *fp, FileType t );
DicomDirImage *GetFirstImage();
DicomDirImage *GetNextImage();
-private:
+protected:
+ DicomDirSerie(bool empty=false);
+ ~DicomDirSerie();
+private:
///chained list of DicomDirImages (to be exploited recursively)
ListDicomDirImage Images;
/// iterator on the DicomDirImages of the current DicomDirSerie
Program: gdcm
Module: $RCSfile: gdcmDicomDirStudy.cxx,v $
Language: C++
- Date: $Date: 2005/07/11 08:20:25 $
- Version: $Revision: 1.40 $
+ Date: $Date: 2005/10/25 14:52:33 $
+ Version: $Revision: 1.41 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
DicomDirSerie *DicomDirStudy::NewSerie()
{
- DicomDirSerie *st = new DicomDirSerie();
- Series.push_back(st);
- return st;
+ DicomDirSerie *dd = DicomDirSerie::New();
+ Series.push_back(dd);
+ return dd;
}
/**
cc != Series.end();
++cc )
{
- delete *cc;
+ (*cc)->Delete();
}
Series.clear();
}
*/
DicomDirVisit *DicomDirStudy::NewVisit()
{
- DicomDirVisit *st = new DicomDirVisit();
- Visits.push_back(st);
- return st;
+ DicomDirVisit *dd = DicomDirVisit::New();
+ Visits.push_back(dd);
+ dd->Delete();
+ return dd;
}
/**
cc != Visits.end();
++cc )
{
- delete *cc;
+ (*cc)->Delete();
}
Visits.clear();
}
Program: gdcm
Module: $RCSfile: gdcmDicomDirStudy.h,v $
Language: C++
- Date: $Date: 2005/09/02 07:10:03 $
- Version: $Revision: 1.29 $
+ Date: $Date: 2005/10/25 14:52:33 $
+ Version: $Revision: 1.30 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
class GDCM_EXPORT DicomDirStudy : public DicomDirObject
{
+ gdcmTypeMacro(DicomDirStudy);
+
public:
- DicomDirStudy(bool empty=false);
- ~DicomDirStudy();
+ static DicomDirStudy *New(bool empty=false) {return new DicomDirStudy(empty);}
void Print(std::ostream &os = std::cout, std::string const &indent = "" );
void WriteContent(std::ofstream *fp, FileType t);
DicomDirStudyComponent *GetNextStudyComponent();
DicomDirStudyComponent *GetLastStudyComponent();
*/
-private:
+protected:
+ DicomDirStudy(bool empty=false);
+ ~DicomDirStudy();
+
+private:
/// chained list of DicomDirSeries (to be exploited hierarchicaly)
ListDicomDirSerie Series;
/// iterator on the DicomDirSeries of the current DicomDirStudy
Program: gdcm
Module: $RCSfile: gdcmDicomDirVisit.h,v $
Language: C++
- Date: $Date: 2005/07/08 19:07:12 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2005/10/25 14:52:34 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
class GDCM_EXPORT DicomDirVisit : public DicomDirObject
{
+ gdcmTypeMacro(DicomDirVisit);
+
public:
- DicomDirVisit(bool empty=false);
- ~DicomDirVisit();
+ static DicomDirVisit *New(bool empty=false) {return new DicomDirVisit(empty);}
void Print( std::ostream &os = std::cout, std::string const &indent = "" );
// void WriteContent( std::ofstream *fp, FileType t );
+protected:
+ DicomDirVisit(bool empty=false);
+ ~DicomDirVisit();
};
} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDict.h,v $
Language: C++
- Date: $Date: 2005/10/23 15:32:30 $
- Version: $Revision: 1.44 $
+ Date: $Date: 2005/10/25 14:52:34 $
+ Version: $Revision: 1.45 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMDICT_H
#define GDCMDICT_H
-#include "gdcmBase.h"
+#include "gdcmRefCounter.h"
#include "gdcmDictEntry.h"
#include <iostream>
* combined with all software versions...
* \see DictSet
*/
-class GDCM_EXPORT Dict : public Base
+class GDCM_EXPORT Dict : public RefCounter
{
+ gdcmTypeMacro(Dict);
+
public:
- Dict();
- Dict(std::string const &filename);
- ~Dict();
+ static Dict *New() {return new Dict();}
+ static Dict *New(std::string const &filename) {return new Dict(filename);}
bool AddDict(std::string const &filename);
bool RemoveDict(std::string const &filename);
DictEntry *GetFirstEntry();
DictEntry *GetNextEntry();
+protected:
+ Dict();
+ Dict(std::string const &filename);
+ ~Dict();
+
private:
void DoTheLoadingJob(std::ifstream &ifs);
Program: gdcm
Module: $RCSfile: gdcmDictGroupName.h,v $
Language: C++
- Date: $Date: 2005/10/23 15:32:31 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2005/10/25 14:52:34 $
+ Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMDICTGROUPNAME_H
#define GDCMDICTGROUPNAME_H
-#include "gdcmCommon.h"
+#include "gdcmRefCounter.h"
+
#include <map>
#include <string>
#include <iostream>
* \brief Container for dicom 'Value Representation' Hash Table.
* \note This is a singleton.
*/
-class GDCM_EXPORT DictGroupName
+class GDCM_EXPORT DictGroupName : public RefCounter
{
+ gdcmTypeMacro(DictGroupName);
+
public:
- DictGroupName(void);
- ~DictGroupName();
+ static DictGroupName *New() {return new DictGroupName();}
void Print(std::ostream &os = std::cout);
const TagName &GetName(uint16_t group);
+protected:
+ DictGroupName();
+ ~DictGroupName();
+
private:
DictGroupNameHT groupName;
};
Program: gdcm
Module: $RCSfile: gdcmDictSet.cxx,v $
Language: C++
- Date: $Date: 2005/10/20 15:24:08 $
- Version: $Revision: 1.71 $
+ Date: $Date: 2005/10/25 14:52:34 $
+ Version: $Revision: 1.72 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
DictPath = BuildDictPath();
std::string pubDictFile(DictPath);
pubDictFile += PUB_DICT_FILENAME;
- Dicts[PUB_DICT_NAME] = new Dict(pubDictFile);
+ Dicts[PUB_DICT_NAME] = Dict::New(pubDictFile);
}
/**
// Remove dictionaries
for (DictSetHT::iterator tag = Dicts.begin(); tag != Dicts.end(); ++tag)
{
- Dict *entryToDelete = tag->second;
- if ( entryToDelete )
- {
- delete entryToDelete;
- }
- tag->second = NULL;
+ if ( tag->second )
+ tag->second->Delete();
}
Dicts.clear();
}
Dict *DictSet::LoadDictFromFile(std::string const &filename,
DictKey const &name)
{
- Dict *newDict = new Dict(filename);
- AppendDict(newDict, name);
+ Dict *newDict = Dict::New(filename);
+ Dicts[name] = newDict;
return newDict;
}
//-----------------------------------------------------------------------------
// Protected
-/**
- * \brief Adds a Dictionary to a DictSet
- * \return always true
- */
-bool DictSet::AppendDict(Dict *newDict, DictKey const &name)
-{
- Dicts[name] = newDict;
-
- return true;
-}
//-----------------------------------------------------------------------------
// Private
Program: gdcm
Module: $RCSfile: gdcmDictSet.h,v $
Language: C++
- Date: $Date: 2005/10/23 15:32:31 $
- Version: $Revision: 1.48 $
+ Date: $Date: 2005/10/25 14:52:34 $
+ Version: $Revision: 1.49 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMDICTSET_H
#define GDCMDICTSET_H
-#include "gdcmBase.h"
+#include "gdcmRefCounter.h"
#include "gdcmDict.h"
#include <map>
* \par having many in memory representations of the same dictionary
* (saving memory).
*/
-class GDCM_EXPORT DictSet : public Base
+class GDCM_EXPORT DictSet : public RefCounter
{
+ gdcmTypeMacro(DictSet);
+
public:
- DictSet();
- ~DictSet();
+ static DictSet *New() {return new DictSet();}
void Print(std::ostream &os = std::cout, std::string const &indent = "" );
static std::string BuildDictPath();
protected:
- bool AppendDict(Dict *NewDict, DictKey const &name);
+ DictSet();
+ ~DictSet();
private:
/// Hash table of all dictionaries contained in this DictSet
Program: gdcm
Module: $RCSfile: gdcmDocEntrySet.h,v $
Language: C++
- Date: $Date: 2005/10/24 16:00:47 $
- Version: $Revision: 1.61 $
+ Date: $Date: 2005/10/25 14:52:34 $
+ Version: $Revision: 1.62 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMDOCENTRYSET_H
#define GDCMDOCENTRYSET_H
-#include "gdcmBase.h"
+#include "gdcmRefCounter.h"
#include "gdcmVRKey.h"
#include "gdcmTagKey.h"
* members to this class since this class is designed as an adapter
* in the form of an abstract base class.
*/
-class GDCM_EXPORT DocEntrySet : public Base
+class GDCM_EXPORT DocEntrySet : public RefCounter
{
-public:
- /// Canonical Constructor
- DocEntrySet();
- /// Canonical Destructor
- virtual ~DocEntrySet() {}
+ gdcmTypeMacro(DocEntrySet);
+public:
/// \brief write any type of entry to the entry set
virtual void WriteContent (std::ofstream *fp, FileType filetype) = 0;
SeqEntry *NewSeqEntry(uint16_t group, uint16_t elem);
protected:
+ /// Canonical Constructor
+ DocEntrySet();
+ /// Canonical Destructor
+ virtual ~DocEntrySet() {}
+
// DictEntry related utilities
DictEntry *GetDictEntry(uint16_t group, uint16_t elem);
DictEntry *GetDictEntry(uint16_t group, uint16_t elem,
Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2005/10/25 12:42:37 $
- Version: $Revision: 1.306 $
+ Date: $Date: 2005/10/25 14:52:34 $
+ Version: $Revision: 1.307 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
break;
}
// create the current SQItem
- SQItem *itemSQ = new SQItem( seqEntry->GetDepthLevel() );
+ SQItem *itemSQ = SQItem::New( seqEntry->GetDepthLevel() );
unsigned int l = newDocEntry->GetReadLength();
if ( l == 0xffffffff )
// end try -----------------
seqEntry->AddSQItem( itemSQ, SQItemNumber );
+ itemSQ->Delete();
newDocEntry->Delete();
SQItemNumber++;
if ( !delim_mode && ((long)(Fp->tellg())-offset ) >= l_max )
Program: gdcm
Module: $RCSfile: gdcmDocument.h,v $
Language: C++
- Date: $Date: 2005/10/19 12:01:51 $
- Version: $Revision: 1.126 $
+ Date: $Date: 2005/10/25 14:52:34 $
+ Version: $Revision: 1.127 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
class GDCM_EXPORT Document : public ElementSet
{
-public:
+ gdcmTypeMacro(Document);
-typedef std::list<DicomElement> ListElements;
+public:
+ typedef std::list<DicomElement> ListElements;
// Loading
//Deprecated : use SetFileName() + Load()
Program: gdcm
Module: $RCSfile: gdcmElementSet.h,v $
Language: C++
- Date: $Date: 2005/10/24 16:00:47 $
- Version: $Revision: 1.48 $
+ Date: $Date: 2005/10/25 14:52:34 $
+ Version: $Revision: 1.49 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
class GDCM_EXPORT ElementSet : public DocEntrySet
{
-public:
- ElementSet();
- ~ElementSet();
+ gdcmTypeMacro(ElementSet);
+public:
virtual void Print(std::ostream &os = std::cout,
std::string const &indent = "" );
bool IsEmpty() { return TagHT.empty(); }
protected:
+ ElementSet();
+ ~ElementSet();
private:
// Variables
Program: gdcm
Module: $RCSfile: gdcmFile.cxx,v $
Language: C++
- Date: $Date: 2005/10/25 14:36:30 $
- Version: $Revision: 1.294 $
+ Date: $Date: 2005/10/25 14:52:34 $
+ Version: $Revision: 1.295 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// These are the deprecated method that one day should be removed (after the next release)
#ifndef GDCM_LEGACY_REMOVE
-/*
- * brief Constructor (DEPRECATED : temporaryly kept not to break the API)
- * param filename name of the file whose header we want to analyze
- * deprecated do not use any longer
- */
-File::File( std::string const &filename )
- :Document( )
-{
- RLEInfo = new RLEFramesInfo;
- JPEGInfo = new JPEGFragmentsInfo;
-
- SetFileName( filename );
- Load( ); // gdcm::Document is first Loaded, then the 'File part'
-}
-
/*
* \ brief Loader. (DEPRECATED : temporaryly kept not to break the API)
* @ param fileName file to be open for parsing
Program: gdcm
Module: $RCSfile: gdcmFile.h,v $
Language: C++
- Date: $Date: 2005/10/06 18:54:50 $
- Version: $Revision: 1.117 $
+ Date: $Date: 2005/10/25 14:52:34 $
+ Version: $Revision: 1.118 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
class GDCM_EXPORT File : public Document
{
+ gdcmTypeMacro(File);
+
public:
- File();
- GDCM_LEGACY(File( std::string const &filename ));
- ~File();
+ static File *New() {return new File();}
// Loading
GDCM_LEGACY(bool Load( std::string const &filename ));
bool Write(std::string fileName, FileType filetype);
protected:
-
+ File();
+ ~File();
+
/// Store the RLE frames info obtained during parsing of pixels.
RLEFramesInfo *RLEInfo;
/// Store the JPEG fragments info obtained during parsing of pixels.
Module: $RCSfile: gdcmFileHelper.cxx,v $
Language: C++
- Date: $Date: 2005/10/25 12:42:01 $
- Version: $Revision: 1.73 $
+ Date: $Date: 2005/10/25 14:52:34 $
+ Version: $Revision: 1.74 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
FileHelper::FileHelper( )
{
- FileInternal = new File( );
- SelfHeader = true;
+ FileInternal = File::New( );
Initialize();
}
FileHelper::FileHelper(File *header)
{
FileInternal = header;
- SelfHeader = false;
+ header->Register();
Initialize();
if ( FileInternal->IsReadable() )
{
}
}
-#ifndef GDCM_LEGACY_REMOVE
-/*
- * brief DEPRECATED : use SetFilename() + SetLoadMode() + Load() methods
- * Constructor dedicated to deal with the *pixels* area of a ACR/DICOMV3
- * file (gdcm::File only deals with the ... header)
- * Opens (in read only and when possible) an existing file and checks
- * for DICOM compliance. Returns NULL on failure.
- * It will be up to the user to load the pixels into memory
- * note the in-memory representation of all available tags found in
- * the DICOM header is post-poned to first header information access.
- * This avoid a double parsing of public part of the header when
- * one sets an a posteriori shadow dictionary (efficiency can be
- * seen as a side effect).
- * param filename file to be opened for parsing
- * deprecated use SetFilename() + Load() methods
- */
-FileHelper::FileHelper(std::string const &filename )
-{
- FileInternal = new File( );
- FileInternal->SetFileName( filename );
- FileInternal->Load();
- SelfHeader = true;
- Initialize();
- if ( FileInternal->IsReadable() )
- {
- PixelReadConverter->GrabInformationsFromFile( FileInternal );
- }
-}
-#endif
-
/**
* \brief canonical destructor
* \note If the header (gdcm::File) was created by the FileHelper constructor,
delete Archive;
}
- if ( SelfHeader )
- {
- delete FileInternal;
- }
+ FileInternal->Unregister();
FileInternal = 0;
}
// Create 'Source Image Sequence' SeqEntry
SeqEntry *sis = SeqEntry::New (
Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x2112) );
- SQItem *sqi = new SQItem(1);
+ SQItem *sqi = SQItem::New(1);
// (we assume 'SOP Instance UID' exists too)
// create 'Referenced SOP Class UID'
DataEntry *e_0008_1150 = DataEntry::New(
Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x1150) );
e_0008_1150->SetString( e_0008_0016->GetString());
sqi->AddEntry(e_0008_1150);
+ e_0008_1150->Delete();
// create 'Referenced SOP Instance UID'
DataEntry *e_0008_0018 = FileInternal->GetDataEntry(0x0008, 0x0018);
Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x1155) );
e_0008_1155->SetString( e_0008_0018->GetString());
sqi->AddEntry(e_0008_1155);
+ e_0008_1155->Delete();
+
+ sis->AddSQItem(sqi,1);
+ sqi->Delete();
- sis->AddSQItem(sqi,1);
// temporarily replaces any previous 'Source Image Sequence'
Archive->Push(sis);
sis->Delete();
Program: gdcm
Module: $RCSfile: gdcmFileHelper.h,v $
Language: C++
- Date: $Date: 2005/10/25 12:43:25 $
- Version: $Revision: 1.28 $
+ Date: $Date: 2005/10/25 14:52:34 $
+ Version: $Revision: 1.29 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#define GDCMFILEHELPER_H
#include "gdcmDebug.h"
-#include "gdcmBase.h"
+#include "gdcmRefCounter.h"
namespace gdcm
* for accessing the image/volume content. One can also use it to
* write Dicom/ACR-NEMA/RAW files.
*/
-class GDCM_EXPORT FileHelper : public Base
+class GDCM_EXPORT FileHelper : public RefCounter
{
+ gdcmTypeMacro(FileHelper);
+
public:
enum FileMode
{
};
public:
- FileHelper( );
- FileHelper( File *header );
- GDCM_LEGACY(FileHelper( std::string const &filename ));
+ static FileHelper *New() {return new FileHelper();}
+ static FileHelper *New(File *header) {return new FileHelper(header);}
virtual ~FileHelper();
bool Write (std::string const &fileName);
protected:
+ FileHelper( );
+ FileHelper( File *header );
+
bool CheckWriteIntegrity();
void SetWriteToRaw();
/// gdcm::File to use to load the file
File *FileInternal;
- /// \brief Whether the underlying \ref gdcm::File was loaded by
- /// the constructor or passed to the constructor.
- /// When false the destructor is in charge of deletion.
- bool SelfHeader;
-
/// Whether already parsed or not
bool Parsed;
Program: gdcm
Module: $RCSfile: gdcmGlobal.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 12:58:28 $
- Version: $Revision: 1.27 $
+ Date: $Date: 2005/10/25 14:52:35 $
+ Version: $Revision: 1.28 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
gdcmWarningMacro( "VR or TS or Dicts already allocated");
return;
}
- Dicts = new DictSet();
- ValRes = new VR();
- TranSyn = new TS();
- GroupName = new DictGroupName();
- ddElem = new DicomDirElement();
+ Dicts = DictSet::New();
+ ValRes = VR::New();
+ TranSyn = TS::New();
+ GroupName = DictGroupName::New();
+ ddElem = DicomDirElement::New();
}
/**
*/
Global::~Global()
{
- delete Dicts;
- delete ValRes;
- delete TranSyn;
- delete GroupName;
- delete ddElem;
+ Dicts->Delete();
+ ValRes->Delete();
+ TranSyn->Delete();
+ GroupName->Delete();
+ ddElem->Delete();
}
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmSQItem.h,v $
Language: C++
- Date: $Date: 2005/10/24 16:00:48 $
- Version: $Revision: 1.46 $
+ Date: $Date: 2005/10/25 14:52:35 $
+ Version: $Revision: 1.47 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
class GDCM_EXPORT SQItem : public DocEntrySet
{
+ gdcmTypeMacro(SQItem);
+
public:
- SQItem(int depthLevel);
- ~SQItem();
+ static SQItem *New(int depthLevel) {return new SQItem(depthLevel);}
virtual void Print(std::ostream &os = std::cout, std::string const &indent = "" );
void WriteContent(std::ofstream *fp, FileType filetype);
void SetDepthLevel(int depth) { SQDepthLevel = depth; }
protected:
+ SQItem(int depthLevel);
+ ~SQItem();
+
// Variables that need to be accessed in subclasses
/// \brief Chained list of Doc Entries
ListDocEntry DocEntries;
Program: gdcm
Module: $RCSfile: gdcmSeqEntry.cxx,v $
Language: C++
- Date: $Date: 2005/10/24 16:00:48 $
- Version: $Revision: 1.59 $
+ Date: $Date: 2005/10/25 14:52:35 $
+ Version: $Revision: 1.60 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// Or we can add (or remove) anywhere, and SQItemNumber will be broken
sqItem->SetSQItemNumber(itemNumber);
Items.push_back(sqItem);
+ sqItem->Register();
}
/**
{
for(ListSQItem::iterator cc = Items.begin(); cc != Items.end(); ++cc)
{
- delete *cc;
+ (*cc)->Unregister();
}
if (SeqTerm)
{
Program: gdcm
Module: $RCSfile: gdcmSerieHelper.cxx,v $
Language: C++
- Date: $Date: 2005/10/25 12:40:03 $
- Version: $Revision: 1.29 $
+ Date: $Date: 2005/10/25 14:52:35 $
+ Version: $Revision: 1.30 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
it != l->end();
++it)
{
- delete *it; // remove each entry
+ (*it)->Delete(); // remove each entry
}
l->clear();
delete l; // remove the container
void SerieHelper::AddFileName(std::string const &filename)
{
// Create a DICOM file
- File *header = new File ();
+ File *header = File::New();
header->SetLoadMode(LoadMode);
header->SetFileName( filename );
header->Load();
else
{
// at least one rule was unmatched we need to deallocate the file:
- delete header;
+ header->Delete();
}
}
else
{
gdcmWarningMacro("Could not read file: " << filename );
- delete header;
+ header->Delete();
}
}
Program: gdcm
Module: $RCSfile: gdcmTS.h,v $
Language: C++
- Date: $Date: 2005/10/18 10:43:32 $
- Version: $Revision: 1.21 $
+ Date: $Date: 2005/10/25 14:52:35 $
+ Version: $Revision: 1.22 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMTS_H
#define GDCMTS_H
-#include "gdcmCommon.h"
+#include "gdcmRefCounter.h"
#include <map>
#include <string>
* \brief Container for dicom 'Transfer Syntax' Hash Table
* \note This is a singleton
*/
-class GDCM_EXPORT TS
+class GDCM_EXPORT TS : public RefCounter
{
+ gdcmTypeMacro(TS);
+
public:
-enum SpecialType {
- ImplicitVRLittleEndian = 0,
- ImplicitVRBigEndianPrivateGE,
- ExplicitVRLittleEndian,
- DeflatedExplicitVRLittleEndian,
- ExplicitVRBigEndian,
- JPEGBaselineProcess1,
- JPEGExtendedProcess2_4,
- JPEGExtendedProcess3_5,
- JPEGSpectralSelectionProcess6_8,
- JPEGFullProgressionProcess10_12,
- JPEGLosslessProcess14,
- JPEGLosslessProcess14_1,
- JPEGLSLossless,
- JPEGLSNearLossless,
- JPEG2000Lossless,
- JPEG2000,
- RLELossless,
- MPEG2MainProfile,
- UnknownTS
-};
+ enum SpecialType {
+ ImplicitVRLittleEndian = 0,
+ ImplicitVRBigEndianPrivateGE,
+ ExplicitVRLittleEndian,
+ DeflatedExplicitVRLittleEndian,
+ ExplicitVRBigEndian,
+ JPEGBaselineProcess1,
+ JPEGExtendedProcess2_4,
+ JPEGExtendedProcess3_5,
+ JPEGSpectralSelectionProcess6_8,
+ JPEGFullProgressionProcess10_12,
+ JPEGLosslessProcess14,
+ JPEGLosslessProcess14_1,
+ JPEGLSLossless,
+ JPEGLSNearLossless,
+ JPEG2000Lossless,
+ JPEG2000,
+ RLELossless,
+ MPEG2MainProfile,
+ UnknownTS
+ };
public:
- TS();
- ~TS();
+ static TS *New() {return new TS();}
void Print(std::ostream &os = std::cout);
SpecialType GetSpecialTransferSyntax(TSKey const &key);
const char* GetSpecialTransferSyntax(SpecialType t);
+protected:
+ TS();
+ ~TS();
+
private:
TSHT TsMap;
};
Program: gdcm
Module: $RCSfile: gdcmVR.h,v $
Language: C++
- Date: $Date: 2005/10/23 14:56:27 $
- Version: $Revision: 1.24 $
+ Date: $Date: 2005/10/25 14:52:35 $
+ Version: $Revision: 1.25 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMVR_H
#define GDCMVR_H
-#include "gdcmCommon.h"
+#include "gdcmRefCounter.h"
#include "gdcmVRKey.h"
#include <map>
* \brief Container for dicom Value Representation Hash Table
* \note This is a singleton
*/
-class GDCM_EXPORT VR
+class GDCM_EXPORT VR : public RefCounter
{
+ gdcmTypeMacro(VR);
+
public:
- VR(void);
- ~VR();
+ static VR *New() {return new VR();}
void Print(std::ostream &os = std::cout);
unsigned short GetAtomicElementLength(VRKey const &tested);
+protected:
+ VR();
+ ~VR();
+
private:
VRHT vr;
};
Program: gdcm
Module: $RCSfile: vtkGdcmReader.cxx,v $
Language: C++
- Date: $Date: 2005/09/20 08:50:57 $
- Version: $Revision: 1.84 $
+ Date: $Date: 2005/10/25 14:52:37 $
+ Version: $Revision: 1.85 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <vtkPointData.h>
#include <vtkLookupTable.h>
-vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.84 $")
+vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.85 $")
vtkStandardNewMacro(vtkGdcmReader)
//-----------------------------------------------------------------------------
fclose(fp);
// Read the file
- file=new gdcm::File();
+ file=gdcm::File::New();
file->SetLoadMode( LoadMode );
file->SetFileName(filename->c_str() );
file->Load();
vtkErrorMacro(<< "Gdcm cannot parse file " << filename->c_str());
vtkErrorMacro(<< "Removing this file from read files: "
<< filename->c_str());
- delete file;
+ file->Delete();
file=NULL;
InternalFileList.push_back(file);
continue;
<< " File type found : " << type.c_str()
<< " (might be 8U, 8S, 16U, 16S, 32U, 32S) \n"
<< " Removing this file from read files");
- delete file;
+ file->Delete();
file=NULL;
InternalFileList.push_back(file);
continue;
}
else if(!TestFileInformation(file))
{
- delete file;
+ file->Delete();
file=NULL;
}
it!=InternalFileList.end();
++it)
{
- delete (*it);
+ (*it)->Delete();
}
}
this->InternalFileList.clear();
if(!f)
return;
- gdcm::FileHelper *fileH = new gdcm::FileHelper( f );
+ gdcm::FileHelper *fileH = gdcm::FileHelper::New( f );
fileH->SetUserFunction( UserFunction );
int numColumns = f->GetXSize();
dst += 2 * planeSize;
}
- delete fileH;
+ fileH->Delete();
}
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: vtkGdcmWriter.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:55 $
- Version: $Revision: 1.25 $
+ Date: $Date: 2005/10/25 14:52:37 $
+ Version: $Revision: 1.26 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#define vtkFloatingPointType float
#endif
-vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.25 $")
+vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.26 $")
vtkStandardNewMacro(vtkGdcmWriter)
//-----------------------------------------------------------------------------
void vtkGdcmWriter::WriteDcmFile(char *fileName, vtkImageData *image)
{
// From here, the write of the file begins
- gdcm::FileHelper *dcmFile = new gdcm::FileHelper();
+ gdcm::FileHelper *dcmFile = gdcm::FileHelper::New();
// Set the image informations
SetImageInformation(dcmFile, image);
{
delete[] dcmFile->GetUserData();
}
- delete dcmFile;
+ dcmFile->Delete();
}
//-----------------------------------------------------------------------------