Module: $RCSfile: gdcmFileHelper.cxx,v $
Language: C++
- Date: $Date: 2005/10/25 12:42:01 $
- Version: $Revision: 1.73 $
+ Date: $Date: 2005/10/26 08:28:58 $
+ Version: $Revision: 1.76 $
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;
- Initialize();
- if ( FileInternal->IsReadable() )
- {
- PixelReadConverter->GrabInformationsFromFile( FileInternal );
- }
-}
+ gdcmAssertMacro(header);
-#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;
+ FileInternal = header;
+ FileInternal->Register();
Initialize();
if ( FileInternal->IsReadable() )
{
PixelReadConverter->GrabInformationsFromFile( FileInternal );
}
}
-#endif
/**
* \brief canonical destructor
delete Archive;
}
- if ( SelfHeader )
- {
- delete FileInternal;
- }
- FileInternal = 0;
+ FileInternal->Unregister();
}
//-----------------------------------------------------------------------------
are force to current Date and Time
--> Conversion Type (0x0008,0x0064)
- is forced to 'SYN'
+ is forced to 'SYN' (Synthetic Image)
--> Study ID, Series Number, Instance Number, Patient Orientation (Type 2)
are created, with empty value if there are missing.
// 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();
// Accession Number
CopyMandatoryEntry(0x0008,0x0050,"");
- // Conversion Type ... FIXME (type 1)
+ // Conversion Type.
+ // Other possible values are :
// See PS 3.3, Page 408
+
+ // DV = Digitized Video
+ // DI = Digital Interface
+ // DF = Digitized Film
+ // WSD = Workstation
+ // SD = Scanned Document
+ // SI = Scanned Image
+ // DRW = Drawing
+ // SYN = Synthetic Image
+
+ // FIXME : Must we Force Value, or Default value ?
+ // Is it Type 1 for any Modality ?
+ // --> Answer seems to be NO :-(
CopyMandatoryEntry(0x0008,0x0064,"SYN");
// ----- Add Mandatory Entries if missing ---