2005-01-25 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
- * Test/VTKTest*.cxx : remove the show variable in each test method because
+ * src/ : rename some methods on Entry (SetXxx, InsertXxx) to have a better
+ use with python. Some methods ard moved from Document to ElementSet or
+ DocEntrySet. The equivalent methods to ElementSet have been added to
+ SQItem and are virtual in DocEntrySet. Methods that may have the same code
+ in SQItem and ElementSet is directly placed in DocEntrySet
+
+2005-01-25 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+ * Test/VTKTest*.cxx : remove the show variable in each test method because
it's useless (the viewer variable replace this variable)
2005-01-25 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
Program: gdcm
Module: $RCSfile: BuildUpDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 16:10:49 $
- Version: $Revision: 1.12 $
+ Date: $Date: 2005/01/25 15:44:22 $
+ 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
((gdcm::Document *)dcmdir)->Print();
gdcm::DicomDirPatient *p1=dcmdir->NewPatient();
- p1->SetEntryValue("patientONE",0x0010, 0x0010);
+ p1->SetValEntry("patientONE",0x0010, 0x0010);
gdcm::DicomDirPatient *p2=dcmdir->NewPatient();
- p2->SetEntryValue("patientTWO",0x0010, 0x0010);
+ p2->SetValEntry("patientTWO",0x0010, 0x0010);
gdcm::DicomDirStudy *s21=p2->NewStudy();
- s21->SetEntryValue("StudyDescrTwo.One",0x0008, 0x1030);
+ s21->SetValEntry("StudyDescrTwo.One",0x0008, 0x1030);
gdcm::DicomDirSerie *s211=s21->NewSerie();
gdcm::DicomDirImage *s2111=s211->NewImage();
(void)s2111; //not used
gdcm::DicomDirStudy *s11=p1->NewStudy();
- s11->SetEntryValue("StudyDescrOne.One",0x0008, 0x1030);
+ s11->SetValEntry("StudyDescrOne.One",0x0008, 0x1030);
// Name of the physician reading study
// Header Entry to be created
- s11->SetEntryValue("Dr Mabuse",0x0008, 0x1060);
+ s11->SetValEntry("Dr Mabuse",0x0008, 0x1060);
gdcm::DicomDirPatient *p3 = dcmdir->NewPatient();
- p3->SetEntryValue("patientTHREE",0x0010, 0x0010);
+ p3->SetValEntry("patientTHREE",0x0010, 0x0010);
std::cout << "\n------- BuildUpDicomDir: Test Print of Patient ONE -----\n";
p1->Print();
Program: gdcm
Module: $RCSfile: FindTags.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 16:10:49 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2005/01/25 15:44:22 $
+ Version: $Revision: 1.12 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
int dataSize = f1->GetImageDataSize();
std::cout << "---> pourFindTaggs : dataSize " << dataSize << std::endl;
- f1->SetEntryValue(RecCode ,0x0008,0x0010);
- f1->SetEntryValue(ManufacturerName ,0x0008,0x0070);
+ f1->SetValEntry(RecCode ,0x0008,0x0010);
+ f1->SetValEntry(ManufacturerName ,0x0008,0x0070);
// ImagePositionPatient
ImagePositionPatient = f1->GetFile()->GetEntryValue(0x0020,0x0032);
// Image Position (RET)
- f1->SetEntryValue(ImagePositionPatient, 0x0020,0x0030);
+ f1->SetValEntry(ImagePositionPatient, 0x0020,0x0030);
sscanf(ImagePositionPatient.c_str(), "%f%c%f%c%f", &x,&c,&y,&c,&z);
// Location
std::string zizi = gdcm::Util::Format("%f",l);
Location = gdcm::Util::DicomString(zizi.c_str());
- f1->SetEntryValue(Location, 0x0020,0x0050);
+ f1->SetValEntry(Location, 0x0020,0x0050);
// sinon, la longueur du champ est erronée (?!?)
// Probable sac de noeud entre strlen(xxx.c_str()) et xxx.length()
zizi = gdcm::Util::Format("%d",0x7FE0);
ImageLocation = gdcm::Util::DicomString(zizi.c_str());
-//f1->SetEntryValue(Location, 0x0028,0x0200);
+//f1->SetValEntry(Location, 0x0028,0x0200);
//f1->GetFile()->SetEntryLength(strlen(ImageLocation.c_str())-1, 0x0020,0x0050); // prudence !
// void* imageData= f1->GetImageData();
Program: gdcm
Module: $RCSfile: TestChangeHeader.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 16:44:53 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2005/01/25 15:44:22 $
+ Version: $Revision: 1.12 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
if(matrix != "gdcm::Unfound")
{
std::cerr << "Aquisition Matrix:" << matrix << std::endl;
- f1->GetFile()->Insert( matrix, 0x0018, 0x1310);
+ f1->GetFile()->InsertValEntry( matrix, 0x0018, 0x1310);
}
f1->GetImageData();
Program: gdcm
Module: $RCSfile: TestCopyDicom.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 16:44:53 $
- Version: $Revision: 1.21 $
+ Date: $Date: 2005/01/25 15:44:22 $
+ 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
{
if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
{
- copy->GetFile()->Insert(
- b->GetBinArea(),
- b->GetLength(),
- b->GetGroup(),
- b->GetElement(),
- b->GetVR() );
+ copy->GetFile()->InsertBinEntry( b->GetBinArea(),b->GetLength(),
+ b->GetGroup(),b->GetElement(),
+ b->GetVR() );
}
else if ( gdcm::ValEntry* v = dynamic_cast<gdcm::ValEntry*>(d) )
{
- copy->GetFile()->Insert(
- v->GetValue(),
- v->GetGroup(),
- v->GetElement(),
- v->GetVR() );
+ copy->GetFile()->InsertValEntry( v->GetValue(),
+ v->GetGroup(),v->GetElement(),
+ v->GetVR() );
}
else
{
Program: gdcm
Module: $RCSfile: TestFromScratch.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 16:44:53 $
- Version: $Revision: 1.13 $
+ Date: $Date: 2005/01/25 15:44:22 $
+ Version: $Revision: 1.14 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// Do not bother with field from private dict
if( v->GetName() != "gdcm::Unknown" )
{
- h2->Insert( v->GetValue(),
- v->GetGroup(),
- v->GetElement(),
- v->GetVR() );
+ h2->InsertValEntry( v->GetValue(),
+ v->GetGroup(),v->GetElement(),
+ v->GetVR() );
}
}
//else
Program: gdcm
Module: $RCSfile: TestPapyrus.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 16:44:53 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2005/01/25 15:44:22 $
+ 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
gdcm::File *n = new gdcm::File();
n->InitializeDefaultFile();
- n->Insert(MediaStSOPinstUID, 0x0002,0x0002);
+ n->InsertValEntry(MediaStSOPinstUID, 0x0002,0x0002);
// Whe keep default gdcm Transfer Syntax (Explicit VR Little Endian)
// since using Papyrus one (Implicit VR Little Endian) is a mess
//n->Insert(TransferSyntax, 0x0002,0x0010);
- n->Insert(StudyDate, 0x0008,0x0020);
- n->Insert(StudyTime, 0x0008,0x0030);
- n->Insert(Modality, 0x0008,0x0060);
- n->Insert(PatientName, 0x0010,0x0010);
-
- n->Insert(SamplesPerPixel, 0x0028,0x0002);
- n->Insert(NumberOfFrames, 0x0028,0x0008);
- n->Insert(Rows, 0x0028,0x0010);
- n->Insert(Columns, 0x0028,0x0011);
- n->Insert(BitsAllocated, 0x0028,0x0100);
- n->Insert(BitsStored, 0x0028,0x0101);
- n->Insert(HighBit, 0x0028,0x0102);
- n->Insert(PixelRepresentation,0x0028,0x0102);
+ n->InsertValEntry(StudyDate, 0x0008,0x0020);
+ n->InsertValEntry(StudyTime, 0x0008,0x0030);
+ n->InsertValEntry(Modality, 0x0008,0x0060);
+ n->InsertValEntry(PatientName, 0x0010,0x0010);
+
+ n->InsertValEntry(SamplesPerPixel, 0x0028,0x0002);
+ n->InsertValEntry(NumberOfFrames, 0x0028,0x0008);
+ n->InsertValEntry(Rows, 0x0028,0x0010);
+ n->InsertValEntry(Columns, 0x0028,0x0011);
+ n->InsertValEntry(BitsAllocated, 0x0028,0x0100);
+ n->InsertValEntry(BitsStored, 0x0028,0x0101);
+ n->InsertValEntry(HighBit, 0x0028,0x0102);
+ n->InsertValEntry(PixelRepresentation,0x0028,0x0102);
// create the file
gdcm::FileHelper *file = new gdcm::FileHelper(n);
Program: gdcm
Module: $RCSfile: WriteDicom.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 16:44:53 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2005/01/25 15:44:22 $
+ 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
std::string nbFrames = f2->GetFile()->GetEntryValue(0x0028, 0x0008);
if(nbFrames != "gdcm::Unfound") {
- f1->GetFile()->Insert( nbFrames, 0x0028, 0x0008);
+ f1->GetFile()->InsertValEntry( nbFrames, 0x0028, 0x0008);
}
- f1->GetFile()->Insert(
+ f1->GetFile()->InsertValEntry(
f2->GetFile()->GetEntryValue(0x0028, 0x0010), 0x0028, 0x0010); // nbLig
- f1->GetFile()->Insert(
+ f1->GetFile()->InsertValEntry(
f2->GetFile()->GetEntryValue(0x0028, 0x0011), 0x0028, 0x0011); // nbCol
// Some other tags should be updated:
Program: gdcm
Module: $RCSfile: WriteDicomSimple.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 16:44:53 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2005/01/25 15:44:22 $
+ 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
// Set the image size
str.str("");
str << SIZE_X;
- header->Insert(str.str(),0x0028,0x0011); // Columns
+ header->InsertValEntry(str.str(),0x0028,0x0011); // Columns
str.str("");
str << SIZE_Y;
- header->Insert(str.str(),0x0028,0x0010); // Rows
+ header->InsertValEntry(str.str(),0x0028,0x0010); // Rows
// Set the pixel type
str.str("");
str << COMPONENT_SIZE * 8;
- header->Insert(str.str(),0x0028,0x0100); // Bits Allocated
- header->Insert(str.str(),0x0028,0x0101); // Bits Stored
+ header->InsertValEntry(str.str(),0x0028,0x0100); // Bits Allocated
+ header->InsertValEntry(str.str(),0x0028,0x0101); // Bits Stored
str.str("");
str << COMPONENT_SIZE * 8 - 1;
- header->Insert(str.str(),0x0028,0x0102); // High Bit
+ header->InsertValEntry(str.str(),0x0028,0x0102); // High Bit
// Set the pixel representation
str.str("");
str << "0"; // Unsigned
- header->Insert(str.str(),0x0028,0x0103); // Pixel Representation
+ header->InsertValEntry(str.str(),0x0028,0x0103); // Pixel Representation
// Set the samples per pixel
str.str("");
str << COMPONENT;
- header->Insert(str.str(),0x0028,0x0002); // Samples per Pixel
+ header->InsertValEntry(str.str(),0x0028,0x0002); // Samples per Pixel
// Set the Window / Level
str.str("");
str << COLOR_WINDOW;
- header->Insert(str.str(),0x0028,0x1051); // Window Width
+ header->InsertValEntry(str.str(),0x0028,0x1051); // Window Width
str.str("");
str << COLOR_LEVEL;
- header->Insert(str.str(),0x0028,0x1050); // Window Center
+ header->InsertValEntry(str.str(),0x0028,0x1050); // Window Center
if( !header->IsReadable() )
{
Program: gdcm
Module: $RCSfile: TestCopyDicom.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 16:44:54 $
- Version: $Revision: 1.35 $
+ Date: $Date: 2005/01/25 15:44:22 $
+ Version: $Revision: 1.36 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
{
if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
{
- copyH->Insert( b->GetBinArea(),
- b->GetLength(),
- b->GetGroup(),
- b->GetElement(),
- b->GetVR() );
+ copyH->InsertBinEntry( b->GetBinArea(),b->GetLength(),
+ b->GetGroup(),b->GetElement(),
+ b->GetVR() );
}
else if ( gdcm::ValEntry* v = dynamic_cast<gdcm::ValEntry*>(d) )
{
- copyH->Insert( v->GetValue(),
- v->GetGroup(),
- v->GetElement(),
- v->GetVR() );
+ copyH->InsertValEntry( v->GetValue(),
+ v->GetGroup(),v->GetElement(),
+ v->GetVR() );
}
else
{
Program: gdcm
Module: $RCSfile: TestCopyRescaleDicom.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 16:44:54 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2005/01/25 15:44:22 $
+ 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
{
if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
{
- copyH->Insert(
- b->GetBinArea(),
- b->GetLength(),
- b->GetGroup(),
- b->GetElement(),
- b->GetVR() );
+ copyH->InsertBinEntry( b->GetBinArea(),b->GetLength(),
+ b->GetGroup(),b->GetElement(),
+ b->GetVR() );
}
else if ( gdcm::ValEntry* v = dynamic_cast<gdcm::ValEntry*>(d) )
{
- copyH->Insert(
- v->GetValue(),
- v->GetGroup(),
- v->GetElement(),
- v->GetVR() );
+ copyH->InsertValEntry( v->GetValue(),
+ v->GetGroup(),v->GetElement(),
+ v->GetVR() );
}
else
{
if( bitsStored == "16" )
{
std::cout << "Rescale...";
- copyH->Insert( "8", 0x0028, 0x0100); // BitsAllocated
- copyH->Insert( "8", 0x0028, 0x0101); // BitsStored
- copyH->Insert( "7", 0x0028, 0x0102); // HighBit
- copyH->Insert( "0", 0x0028, 0x0103); //Pixel Representation
+ copyH->InsertValEntry( "8", 0x0028, 0x0100); // BitsAllocated
+ copyH->InsertValEntry( "8", 0x0028, 0x0101); // BitsStored
+ copyH->InsertValEntry( "7", 0x0028, 0x0102); // HighBit
+ copyH->InsertValEntry( "0", 0x0028, 0x0103); //Pixel Representation
// We assume the value were from 0 to uint16_t max
rescaleSize = dataSize / 2;
Program: gdcm
Module: $RCSfile: TestWriteSimple.cxx,v $
Language: C++
- Date: $Date: 2005/01/25 15:29:33 $
- Version: $Revision: 1.15 $
+ Date: $Date: 2005/01/25 15:44:23 $
+ 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
// Set the image size
str.str("");
str << img.sizeX;
- header->Insert(str.str(),0x0028,0x0011); // Columns
+ header->InsertValEntry(str.str(),0x0028,0x0011); // Columns
str.str("");
str << img.sizeY;
- header->Insert(str.str(),0x0028,0x0010); // Rows
+ header->InsertValEntry(str.str(),0x0028,0x0010); // Rows
if(img.sizeZ>1)
{
str.str("");
str << img.sizeZ;
- header->Insert(str.str(),0x0028,0x0008); // Number of Frames
+ header->InsertValEntry(str.str(),0x0028,0x0008); // Number of Frames
}
// Set the pixel type
str.str("");
str << img.componentSize;
- header->Insert(str.str(),0x0028,0x0100); // Bits Allocated
+ header->InsertValEntry(str.str(),0x0028,0x0100); // Bits Allocated
str.str("");
str << img.componentUse;
- header->Insert(str.str(),0x0028,0x0101); // Bits Stored
+ header->InsertValEntry(str.str(),0x0028,0x0101); // Bits Stored
str.str("");
str << img.componentSize - 1;
- header->Insert(str.str(),0x0028,0x0102); // High Bit
+ header->InsertValEntry(str.str(),0x0028,0x0102); // High Bit
// Set the pixel representation
str.str("");
str << img.sign;
- header->Insert(str.str(),0x0028,0x0103); // Pixel Representation
+ header->InsertValEntry(str.str(),0x0028,0x0103); // Pixel Representation
// Set the samples per pixel
str.str("");
str << img.components;
- header->Insert(str.str(),0x0028,0x0002); // Samples per Pixel
+ header->InsertValEntry(str.str(),0x0028,0x0002); // Samples per Pixel
if( !header->IsReadable() )
{
Program: gdcm
Module: $RCSfile: gdcmDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/01/25 11:11:58 $
- Version: $Revision: 1.117 $
+ Date: $Date: 2005/01/25 15:44:23 $
+ 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
DicomDirPatient *DicomDir::GetNextPatient()
{
gdcmAssertMacro (ItPatient != Patients.end());
- {
- ++ItPatient;
- if ( ItPatient != Patients.end() )
- return *ItPatient;
- }
+
+ ++ItPatient;
+ if ( ItPatient != Patients.end() )
+ return *ItPatient;
return NULL;
}
Program: gdcm
Module: $RCSfile: gdcmDicomDirPatient.cxx,v $
Language: C++
- Date: $Date: 2005/01/25 11:11:58 $
- Version: $Revision: 1.32 $
+ Date: $Date: 2005/01/25 15:44:23 $
+ 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
DicomDirStudy *DicomDirPatient::GetNextStudy()
{
gdcmAssertMacro (ItStudy != Studies.end())
- {
- ++ItStudy;
- if (ItStudy != Studies.end())
- return *ItStudy;
- }
+
+ ++ItStudy;
+ if (ItStudy != Studies.end())
+ return *ItStudy;
return NULL;
}
Program: gdcm
Module: $RCSfile: gdcmDicomDirSerie.cxx,v $
Language: C++
- Date: $Date: 2005/01/25 11:11:58 $
- Version: $Revision: 1.34 $
+ Date: $Date: 2005/01/25 15:44:23 $
+ Version: $Revision: 1.35 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
DicomDirImage *DicomDirSerie::GetNextImage()
{
gdcmAssertMacro (ItImage != Images.end());
- {
- ++ItImage;
- if (ItImage != Images.end())
- return *ItImage;
- }
+
+ ++ItImage;
+ if (ItImage != Images.end())
+ return *ItImage;
return NULL;
}
Program: gdcm
Module: $RCSfile: gdcmDicomDirStudy.cxx,v $
Language: C++
- Date: $Date: 2005/01/25 11:11:58 $
- Version: $Revision: 1.31 $
+ Date: $Date: 2005/01/25 15:44:23 $
+ 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
DicomDirSerie *DicomDirStudy::GetNextSerie()
{
gdcmAssertMacro (ItSerie != Series.end());
- {
- ++ItSerie;
- if (ItSerie != Series.end())
- return *ItSerie;
- }
+
+ ++ItSerie;
+ if (ItSerie != Series.end())
+ return *ItSerie;
return NULL;
}
Program: gdcm
Module: $RCSfile: gdcmDocEntrySet.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 14:14:11 $
- Version: $Revision: 1.44 $
+ Date: $Date: 2005/01/25 15:44:23 $
+ 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
//-----------------------------------------------------------------------------
// Public
+/**
+ * \brief Get the (std::string representable) value of the Dicom entry
+ * @param group Group number of the searched tag.
+ * @param elem Element number of the searched tag.
+ * @return Corresponding element value when it exists,
+ * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
+ */
+std::string DocEntrySet::GetEntryValue(uint16_t group, uint16_t elem)
+{
+ ValEntry *entry = GetValEntry(group,elem);
+ if( entry )
+ return entry->GetValue();
+ return GDCM_UNFOUND;
+}
+
+/**
+ * \brief Gets (from Header) a 'non string' element value
+ * (LoadElementValues has already be executed)
+ * @param group group number of the Entry
+ * @param elem element number of the Entry
+ * @return Pointer to the 'non string' area
+ */
+void *DocEntrySet::GetEntryBinArea(uint16_t group, uint16_t elem)
+{
+ BinEntry *entry = GetBinEntry(group,elem);
+ if( entry )
+ return entry->GetBinArea();
+ return 0;
+}
+
+/**
+ * \brief Searches within Header Entries (Dicom Elements) parsed with
+ * the public and private dictionaries
+ * for the value length of a given tag..
+ * @param group Group number of the searched tag.
+ * @param elem Element number of the searched tag.
+ * @return Corresponding element length; -2 if not found
+ */
+int DocEntrySet::GetEntryLength(uint16_t group, uint16_t elem)
+{
+ DocEntry *entry = GetDocEntry(group,elem);
+ if( entry )
+ return entry->GetLength();
+ return -1;
+}
+
+/**
+ * \brief Searches within Header Entries (Dicom Elements) parsed with
+ * the public and private dictionaries
+ * for the element value representation of a given tag..
+ * Obtaining the VR (Value Representation) might be needed by caller
+ * to convert the string typed content to caller's native type
+ * (think of C++ vs Python). The VR is actually of a higher level
+ * of semantics than just the native C++ type.
+ * @param group Group number of the searched tag.
+ * @param elem Element number of the searched tag.
+ * @return Corresponding element value representation when it exists,
+ * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
+ */
+std::string DocEntrySet::GetEntryVR(uint16_t group, uint16_t elem)
+{
+ DocEntry *entry = GetDocEntry(group,elem);
+ if( entry )
+ return entry->GetVR();
+ return GDCM_UNFOUND;
+}
+
+/**
+ * \brief Same as \ref Document::GetDocEntry except it only
+ * returns a result when the corresponding entry is of type
+ * ValEntry.
+ * @param group Group number of the searched Dicom Element
+ * @param elem Element number of the searched Dicom Element
+ * @return When present, the corresponding ValEntry.
+ */
+ValEntry *DocEntrySet::GetValEntry(uint16_t group, uint16_t elem)
+{
+ DocEntry *currentEntry = GetDocEntry(group, elem);
+ if ( !currentEntry )
+ return NULL;
+
+ return dynamic_cast<ValEntry*>(currentEntry);
+}
+
+/**
+ * \brief Same as \ref Document::GetDocEntry except it only
+ * returns a result when the corresponding entry is of type
+ * BinEntry.
+ * @param group Group number of the searched Dicom Element
+ * @param elem Element number of the searched Dicom Element
+ * @return When present, the corresponding BinEntry.
+ */
+BinEntry *DocEntrySet::GetBinEntry(uint16_t group, uint16_t elem)
+{
+ DocEntry *currentEntry = GetDocEntry(group, elem);
+ if ( !currentEntry )
+ return NULL;
+
+ return dynamic_cast<BinEntry*>(currentEntry);
+}
+
+/**
+ * \brief Same as \ref Document::GetDocEntry except it only
+ * returns a result when the corresponding entry is of type
+ * SeqEntry.
+ * @param group Group number of the searched Dicom Element
+ * @param elem Element number of the searched Dicom Element
+ * @return When present, the corresponding SeqEntry.
+ */
+SeqEntry *DocEntrySet::GetSeqEntry(uint16_t group, uint16_t elem)
+{
+ DocEntry *currentEntry = GetDocEntry(group, elem);
+ if ( !currentEntry )
+ return NULL;
+
+ return dynamic_cast<SeqEntry*>(currentEntry);
+}
+
+/**
+ * \brief Accesses an existing DocEntry (i.e. a Dicom Element)
+ * through it's (group, element) and modifies it's content with
+ * the given value.
+ * @param content new value (string) to substitute with
+ * @param group group number of the Dicom Element to modify
+ * @param elem element number of the Dicom Element to modify
+ */
+bool DocEntrySet::SetValEntry(std::string const& content,
+ uint16_t group, uint16_t elem)
+{
+ ValEntry *entry = GetValEntry(group, elem);
+ if (!entry )
+ {
+ gdcmVerboseMacro( "No corresponding ValEntry (try promotion first).");
+ return false;
+ }
+ return SetValEntry(content,entry);
+}
+
+/**
+ * \brief Accesses an existing DocEntry (i.e. a Dicom Element)
+ * through it's (group, element) and modifies it's content with
+ * the given value.
+ * @param content new value (void* -> uint8_t*) to substitute with
+ * @param lgth new value length
+ * @param group group number of the Dicom Element to modify
+ * @param elem element number of the Dicom Element to modify
+ */
+bool DocEntrySet::SetBinEntry(uint8_t*content, int lgth,
+ uint16_t group, uint16_t elem)
+{
+ BinEntry *entry = GetBinEntry(group, elem);
+ if (!entry )
+ {
+ gdcmVerboseMacro( "No corresponding ValEntry (try promotion first).");
+ return false;
+ }
+
+ return SetBinEntry(content,lgth,entry);
+}
+
+/**
+ * \brief Accesses an existing DocEntry (i.e. a Dicom Element)
+ * and modifies it's content with the given value.
+ * @param content new value (string) to substitute with
+ * @param entry Entry to be modified
+ */
+bool DocEntrySet::SetValEntry(std::string const &content, ValEntry *entry)
+{
+ if(entry)
+ {
+ entry->SetValue(content);
+ return true;
+ }
+ return false;
+}
+
+/**
+ * \brief Accesses an existing BinEntry (i.e. a Dicom Element)
+ * and modifies it's content with the given value.
+ * @param content new value (void* -> uint8_t*) to substitute with
+ * @param entry Entry to be modified
+ * @param lgth new value length
+ */
+bool DocEntrySet::SetBinEntry(uint8_t *content, int lgth, BinEntry *entry)
+{
+ if(entry)
+ {
+ entry->SetBinArea(content);
+ entry->SetLength(lgth);
+ entry->SetValue(GDCM_BINLOADED);
+ return true;
+ }
+ return false;
+}
+
+/**
+ * \brief Modifies the value of a given Doc Entry (Dicom Element)
+ * when it exists. Create it with the given value when unexistant.
+ * @param value (string) Value to be set
+ * @param group Group number of the Entry
+ * @param elem Element number of the Entry
+ * @param vr V(alue) R(epresentation) of the Entry -if private Entry-
+ * \return pointer to the modified/created Header Entry (NULL when creation
+ * failed).
+ */
+ValEntry *DocEntrySet::InsertValEntry(std::string const &value,
+ uint16_t group, uint16_t elem,
+ TagName const &vr )
+{
+ ValEntry *valEntry = 0;
+ DocEntry *currentEntry = GetDocEntry( group, elem);
+
+ if (currentEntry)
+ {
+ valEntry = dynamic_cast<ValEntry *>(currentEntry);
+ // Verify the VR
+ if( valEntry )
+ if( valEntry->GetVR()!=vr )
+ valEntry = NULL;
+
+ // if currentEntry doesn't correspond to the requested valEntry
+ if( !valEntry)
+ {
+ if( !RemoveEntry(currentEntry) )
+ {
+ gdcmVerboseMacro( "Removal of previous DocEntry failed.");
+
+ return NULL;
+ }
+ }
+ }
+
+ // Create a new valEntry if necessary
+ if( !valEntry )
+ {
+ valEntry = NewValEntry(group, elem, vr);
+
+ if ( !AddEntry(valEntry) )
+ {
+ gdcmVerboseMacro("AddEntry failed although this is a creation.");
+
+ delete valEntry;
+ return NULL;
+ }
+ }
+
+ // Set the binEntry value
+ SetValEntry(value, valEntry); // The std::string value
+ return valEntry;
+}
+
+/*
+ * \brief Modifies the value of a given Header Entry (Dicom Element)
+ * when it exists. Create it with the given value when unexistant.
+ * A copy of the binArea is made to be kept in the Document.
+ * @param binArea (binary) value to be set
+ * @param group Group number of the Entry
+ * @param elem Element number of the Entry
+ * @param vr V(alue) R(epresentation) of the Entry -if private Entry-
+ * \return pointer to the modified/created Header Entry (NULL when creation
+ * failed).
+ */
+BinEntry *DocEntrySet::InsertBinEntry(uint8_t *binArea,int lgth,
+ uint16_t group, uint16_t elem,
+ TagName const &vr )
+{
+ BinEntry *binEntry = 0;
+ DocEntry *currentEntry = GetDocEntry( group, elem);
+
+ // Verify the currentEntry
+ if (currentEntry)
+ {
+ binEntry = dynamic_cast<BinEntry *>(currentEntry);
+
+ // Verify the VR
+ if( binEntry )
+ if( binEntry->GetVR()!=vr )
+ binEntry = NULL;
+
+ // if currentEntry doesn't correspond to the requested valEntry
+ if( !binEntry)
+ {
+ if( !RemoveEntry(currentEntry) )
+ {
+ gdcmVerboseMacro( "Removal of previous DocEntry failed.");
+
+ return NULL;
+ }
+ }
+ }
+
+ // Create a new binEntry if necessary
+ if( !binEntry)
+ {
+ binEntry = NewBinEntry(group, elem, vr);
+
+ if ( !AddEntry(binEntry) )
+ {
+ gdcmVerboseMacro( "AddEntry failed allthough this is a creation.");
+
+ delete binEntry;
+ return NULL;
+ }
+ }
+
+ // Set the binEntry value
+ uint8_t *tmpArea;
+ if( lgth>0 && binArea )
+ {
+ tmpArea = new uint8_t[lgth];
+ memcpy(tmpArea,binArea,lgth);
+ }
+ else
+ {
+ tmpArea = 0;
+ }
+ if( !SetBinEntry(tmpArea,lgth,binEntry) )
+ {
+ if( tmpArea )
+ {
+ delete[] tmpArea;
+ }
+ }
+
+ return binEntry;
+}
+
+/*
+ * \brief Modifies the value of a given Header Entry (Dicom Element)
+ * when it exists. Creates it when unexistant.
+ * @param group Group number of the Entry
+ * @param elem Element number of the Entry
+ * \return pointer to the modified/created SeqEntry (NULL when creation
+ * failed).
+ */
+SeqEntry *DocEntrySet::InsertSeqEntry(uint16_t group, uint16_t elem)
+{
+ SeqEntry *seqEntry = 0;
+ DocEntry *currentEntry = GetDocEntry( group, elem);
+
+ // Verify the currentEntry
+ if( currentEntry )
+ {
+ seqEntry = dynamic_cast<SeqEntry *>(currentEntry);
+
+ // Verify the VR
+ if( seqEntry )
+ if( seqEntry->GetVR()!="SQ" )
+ seqEntry = NULL;
+
+ // if currentEntry doesn't correspond to the requested valEntry
+ if( !seqEntry )
+ {
+ if (!RemoveEntry(currentEntry))
+ {
+ gdcmVerboseMacro( "Removal of previous DocEntry failed.");
+
+ return NULL;
+ }
+ }
+ }
+ // Create a new seqEntry if necessary
+ if( !seqEntry )
+ {
+ seqEntry = NewSeqEntry(group, elem);
+
+ if( !AddEntry(seqEntry) )
+ {
+ gdcmVerboseMacro( "AddEntry failed allthough this is a creation.");
+
+ delete seqEntry;
+ return NULL;
+ }
+ }
+ return seqEntry;
+}
+
+/**
+ * \brief Checks if a given Dicom Element exists within the H table
+ * @param group Group number of the searched Dicom Element
+ * @param elem Element number of the searched Dicom Element
+ * @return true is found
+ */
+bool DocEntrySet::CheckIfEntryExist(uint16_t group, uint16_t elem )
+{
+ return GetDocEntry(group,elem)!=NULL;
+}
/**
* \brief Request a new virtual dict entry to the dict set
return goodEntry;
}
-
-
//-----------------------------------------------------------------------------
// Private
-} // end namespace gdcm
-
//-----------------------------------------------------------------------------
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmDocEntrySet.h,v $
Language: C++
- Date: $Date: 2005/01/25 11:11:58 $
- Version: $Revision: 1.43 $
+ Date: $Date: 2005/01/25 15:44:23 $
+ Version: $Revision: 1.44 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
DocEntrySet() {};
virtual ~DocEntrySet() {};
- // ------- '... =0;' stands for 'Pure Virtual'
+ /// \brief write any type of entry to the entry set
+ virtual void WriteContent (std::ofstream *fp, FileType filetype) = 0;
/// \brief Remove all Entry in the entry set
virtual void ClearEntry() = 0;
-
/// \brief adds any type of entry to the entry set
virtual bool AddEntry(DocEntry *Entry) = 0;
-
/// \brief Removes any type of entry out of the entry set, and destroys it
virtual bool RemoveEntry(DocEntry *EntryToRemove)=0;
-
/// \brief Removes any type of entry out of the entry set, DOESN'T destroy it
virtual bool RemoveEntryNoDestroy(DocEntry *EntryToRemove)= 0;
- /// \brief write any type of entry to the entry set
- virtual void WriteContent (std::ofstream *fp,
- FileType filetype) = 0;
+ virtual DocEntry *GetFirstEntry()=0;
+ virtual DocEntry *GetNextEntry()=0;
- /// \brief Gets any type of DocEntry, identified by its (group,elem)
- virtual DocEntry *GetDocEntry(uint16_t group,
- uint16_t elem) = 0;
+ virtual std::string GetEntryValue(uint16_t group, uint16_t elem);
+ virtual void *GetEntryBinArea(uint16_t group, uint16_t elem);
+ virtual int GetEntryLength(uint16_t group, uint16_t elem);
+ virtual std::string GetEntryVR(uint16_t group, uint16_t elem);
+ /// \brief Gets any type of DocEntry, identified by its (group,elem)
+ virtual DocEntry *GetDocEntry(uint16_t group,uint16_t elem) = 0;
/// \brief Gets a ValEntry, identified by its (group,elem)
- virtual ValEntry *GetValEntry(uint16_t group,
- uint16_t elem) = 0;
+ virtual ValEntry *GetValEntry(uint16_t group,uint16_t elem);
/// \brief Gets a BinEntry, identified by its (group,elem)
- virtual BinEntry *GetBinEntry(uint16_t group,
- uint16_t elem) = 0;
-
+ virtual BinEntry *GetBinEntry(uint16_t group,uint16_t elem);
/// \brief Gets a SeqEntry, identified by its (group,elem)
- virtual SeqEntry *GetSeqEntry(uint16_t group,
- uint16_t elem) = 0;
-
- /// \brief Gets the 'string value' of a ValEntry
- /// identified by its (group,elem) - Sorry for the name !...-
- virtual std::string GetEntryValue(uint16_t group, uint16_t elem) = 0;
-
- virtual DocEntry *GetFirstEntry()=0;
- virtual DocEntry *GetNextEntry()=0;
-
- DictEntry *NewVirtualDictEntry(uint16_t group,
- uint16_t elem,
+ virtual SeqEntry *GetSeqEntry(uint16_t group,uint16_t elem);
+
+ virtual bool SetValEntry(std::string const &content,
+ uint16_t group, uint16_t elem);
+ virtual bool SetBinEntry(uint8_t *content, int lgth,
+ uint16_t group, uint16_t elem);
+ virtual bool SetValEntry(std::string const &content, ValEntry *entry);
+ virtual bool SetBinEntry(uint8_t *content, int lgth, BinEntry *entry);
+
+ virtual ValEntry *InsertValEntry(std::string const &value,
+ uint16_t group, uint16_t elem,
+ TagName const &vr = GDCM_UNKNOWN);
+ virtual BinEntry *InsertBinEntry(uint8_t *binArea, int lgth,
+ uint16_t group, uint16_t elem,
+ TagName const &vr = GDCM_UNKNOWN);
+ virtual SeqEntry *InsertSeqEntry(uint16_t group, uint16_t elem);
+
+ virtual bool IsEmpty() = 0;
+ virtual bool CheckIfEntryExist(uint16_t group, uint16_t elem);
+
+ DictEntry *NewVirtualDictEntry(uint16_t group,uint16_t elem,
TagName const &vr = GDCM_UNKNOWN,
TagName const &vm = GDCM_UNKNOWN,
TagName const &name = GDCM_UNKNOWN );
protected:
// DocEntry related utilities
-
ValEntry *NewValEntry(uint16_t group,uint16_t elem,
TagName const &vr = GDCM_UNKNOWN);
BinEntry *NewBinEntry(uint16_t group,uint16_t elem,
Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2005/01/25 11:25:33 $
- Version: $Revision: 1.209 $
+ Date: $Date: 2005/01/25 15:44:23 $
+ Version: $Revision: 1.210 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
Filetype = ACR_LIBIDO;
std::string rows = GetEntryValue(0x0028, 0x0010);
std::string columns = GetEntryValue(0x0028, 0x0011);
- SetEntryValue(columns, 0x0028, 0x0010);
- SetEntryValue(rows , 0x0028, 0x0011);
+ SetValEntry(columns, 0x0028, 0x0010);
+ SetValEntry(rows , 0x0028, 0x0011);
}
// ----------------- End of ACR-LibIDO kludge ------------------
}
return false;
}
- //if( TagHT.empty() )
if ( IsEmpty() )
{
gdcmVerboseMacro( "No tag in internal hash table.");
ElementSet::WriteContent(fp, filetype); // This one is recursive
}
-/**
- * \brief Modifies the value of a given Doc Entry (Dicom Element)
- * when it exists. Create it with the given value when unexistant.
- * @param value (string) Value to be set
- * @param group Group number of the Entry
- * @param elem Element number of the Entry
- * @param vr V(alue) R(epresentation) of the Entry -if private Entry-
- * \return pointer to the modified/created Header Entry (NULL when creation
- * failed).
- */
-ValEntry *Document::Insert(std::string const &value,
- uint16_t group,
- uint16_t elem,
- TagName const &vr )
-{
- ValEntry *valEntry = 0;
- DocEntry *currentEntry = GetDocEntry( group, elem);
-
- if (currentEntry)
- {
- valEntry = dynamic_cast< ValEntry* >(currentEntry);
-
- // Verify the VR
- if( valEntry )
- if( valEntry->GetVR()!=vr )
- valEntry=NULL;
-
- // if currentEntry doesn't correspond to the requested valEntry
- if( !valEntry)
- {
- if (!RemoveEntry(currentEntry))
- {
- gdcmVerboseMacro( "Removal of previous DocEntry failed.");
-
- return NULL;
- }
- }
- }
-
- // Create a new valEntry if necessary
- if (!valEntry)
- {
- valEntry = NewValEntry(group, elem, vr);
-
- if ( !AddEntry(valEntry))
- {
- gdcmVerboseMacro("AddEntry failed although this is a creation.");
-
- delete valEntry;
- return NULL;
- }
- }
-
- // Set the binEntry value
- SetEntryValue(value, valEntry); // The std::string value
- return valEntry;
-}
-
-/*
- * \brief Modifies the value of a given Header Entry (Dicom Element)
- * when it exists. Create it with the given value when unexistant.
- * A copy of the binArea is made to be kept in the Document.
- * @param binArea (binary) value to be set
- * @param group Group number of the Entry
- * @param elem Element number of the Entry
- * @param vr V(alue) R(epresentation) of the Entry -if private Entry-
- * \return pointer to the modified/created Header Entry (NULL when creation
- * failed).
- */
-BinEntry *Document::Insert(uint8_t *binArea,
- int lgth,
- uint16_t group,
- uint16_t elem,
- TagName const &vr )
-{
- BinEntry *binEntry = 0;
- DocEntry *currentEntry = GetDocEntry( group, elem);
-
- // Verify the currentEntry
- if (currentEntry)
- {
- binEntry = dynamic_cast< BinEntry* >(currentEntry);
-
- // Verify the VR
- if( binEntry )
- if( binEntry->GetVR()!=vr )
- binEntry=NULL;
-
- // if currentEntry doesn't correspond to the requested valEntry
- if( !binEntry)
- {
- if (!RemoveEntry(currentEntry))
- {
- gdcmVerboseMacro( "Removal of previous DocEntry failed.");
-
- return NULL;
- }
- }
- }
-
- // Create a new binEntry if necessary
- if (!binEntry)
- {
- binEntry = NewBinEntry(group, elem, vr);
-
- if ( !AddEntry(binEntry))
- {
- gdcmVerboseMacro( "AddEntry failed allthough this is a creation.");
-
- delete binEntry;
- return NULL;
- }
- }
-
- // Set the binEntry value
- uint8_t *tmpArea;
- if (lgth>0 && binArea)
- {
- tmpArea = new uint8_t[lgth];
- memcpy(tmpArea,binArea,lgth);
- }
- else
- {
- tmpArea = 0;
- }
- if (!SetEntryBinArea(tmpArea,lgth,binEntry))
- {
- if (tmpArea)
- {
- delete[] tmpArea;
- }
- }
-
- return binEntry;
-}
-
-/*
- * \brief Modifies the value of a given Header Entry (Dicom Element)
- * when it exists. Creates it when unexistant.
- * @param group Group number of the Entry
- * @param elem Element number of the Entry
- * \return pointer to the modified/created SeqEntry (NULL when creation
- * failed).
- */
-SeqEntry *Document::Insert( uint16_t group, uint16_t elem)
-{
- SeqEntry *seqEntry = 0;
- DocEntry *currentEntry = GetDocEntry( group, elem);
-
- // Verify the currentEntry
- if (currentEntry)
- {
- seqEntry = dynamic_cast< SeqEntry* >(currentEntry);
-
- // Verify the VR
- if( seqEntry )
- if( seqEntry->GetVR()!="SQ" )
- seqEntry=NULL;
-
- // if currentEntry doesn't correspond to the requested valEntry
- if( !seqEntry)
- {
- if (!RemoveEntry(currentEntry))
- {
- gdcmVerboseMacro( "Removal of previous DocEntry failed.");
-
- return NULL;
- }
- }
- }
- // Create a new seqEntry if necessary
- if (!seqEntry)
- {
- seqEntry = NewSeqEntry(group, elem);
-
- if ( !AddEntry(seqEntry))
- {
- gdcmVerboseMacro( "AddEntry failed allthough this is a creation.");
-
- delete seqEntry;
- return NULL;
- }
- }
- return seqEntry;
-}
-
-/**
- * \brief Set a new value if the invoked element exists
- * Seems to be useless !!!
- * @param value new element value
- * @param group group number of the Entry
- * @param elem element number of the Entry
- * \return boolean
- */
-bool Document::ReplaceIfExist(std::string const &value,
- uint16_t group, uint16_t elem )
-{
- SetEntryValue(value, group, elem);
-
- return true;
-}
-
//-----------------------------------------------------------------------------
// Protected
-
-/**
- * \brief Searches within Header Entries (Dicom Elements) parsed with
- * the public and private dictionaries
- * for the element value representation of a given tag..
- * Obtaining the VR (Value Representation) might be needed by caller
- * to convert the string typed content to caller's native type
- * (think of C++ vs Python). The VR is actually of a higher level
- * of semantics than just the native C++ type.
- * @param group Group number of the searched tag.
- * @param elem Element number of the searched tag.
- * @return Corresponding element value representation when it exists,
- * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
- */
-std::string Document::GetEntryVR(uint16_t group, uint16_t elem)
-{
- DocEntry *element = GetDocEntry(group, elem);
- if ( !element )
- {
- return GDCM_UNFOUND;
- }
- return element->GetVR();
-}
-
-/**
- * \brief Searches within Header Entries (Dicom Elements) parsed with
- * the public and private dictionaries
- * for the value length of a given tag..
- * @param group Group number of the searched tag.
- * @param elem Element number of the searched tag.
- * @return Corresponding element length; -2 if not found
- */
-int Document::GetEntryLength(uint16_t group, uint16_t elem)
-{
- DocEntry *element = GetDocEntry(group, elem);
- if ( !element )
- {
- return -2; //magic number
- }
- return element->GetLength();
-}
-
-/**
- * \brief Accesses an existing DocEntry (i.e. a Dicom Element)
- * through it's (group, element) and modifies it's content with
- * the given value.
- * @param content new value (string) to substitute with
- * @param group group number of the Dicom Element to modify
- * @param elem element number of the Dicom Element to modify
- */
-bool Document::SetEntryValue(std::string const& content,
- uint16_t group, uint16_t elem)
-{
- ValEntry *entry = GetValEntry(group, elem);
- if (!entry )
- {
- gdcmVerboseMacro( "No corresponding ValEntry (try promotion first).");
- return false;
- }
- return SetEntryValue(content,entry);
-}
-/**
- * \brief Accesses an existing DocEntry (i.e. a Dicom Element)
- * through it's (group, element) and modifies it's content with
- * the given value.
- * @param content new value (void* -> uint8_t*) to substitute with
- * @param lgth new value length
- * @param group group number of the Dicom Element to modify
- * @param elem element number of the Dicom Element to modify
- */
-bool Document::SetEntryBinArea(uint8_t*content, int lgth,
- uint16_t group, uint16_t elem)
-{
- BinEntry *entry = GetBinEntry(group, elem);
- if (!entry )
- {
- gdcmVerboseMacro( "No corresponding ValEntry (try promotion first).");
- return false;
- }
-
- return SetEntryBinArea(content,lgth,entry);
-}
-
-/**
- * \brief Accesses an existing DocEntry (i.e. a Dicom Element)
- * and modifies it's content with the given value.
- * @param content new value (string) to substitute with
- * @param entry Entry to be modified
- */
-bool Document::SetEntryValue(std::string const &content, ValEntry *entry)
-{
- if(entry)
- {
- entry->SetValue(content);
- return true;
- }
- return false;
-}
-
-/**
- * \brief Accesses an existing BinEntry (i.e. a Dicom Element)
- * and modifies it's content with the given value.
- * @param content new value (void* -> uint8_t*) to substitute with
- * @param entry Entry to be modified
- * @param lgth new value length
- */
-bool Document::SetEntryBinArea(uint8_t *content, int lgth, BinEntry *entry)
-{
- if(entry)
- {
- // Hope Binary field length is *never* wrong
- /*if(lgth%2) // Non even length are padded with a space (020H).
- {
- lgth++;
- //content = content + '\0'; // fing a trick to enlarge a binary field?
- }*/
-
- entry->SetBinArea(content);
- entry->SetLength(lgth);
- entry->SetValue(GDCM_BINLOADED);
- return true;
- }
- return false;
-}
-
-/**
- * \brief Gets (from Header) a 'non string' element value
- * (LoadElementValues has already be executed)
- * @param group group number of the Entry
- * @param elem element number of the Entry
- * @return Pointer to the 'non string' area
- */
-void *Document::GetEntryBinArea(uint16_t group, uint16_t elem)
-{
- DocEntry *entry = GetDocEntry(group, elem);
- if (!entry)
- {
- gdcmVerboseMacro( "No entry");
- return 0;
- }
- if ( BinEntry *binEntry = dynamic_cast<BinEntry*>(entry) )
- {
- return binEntry->GetBinArea();
- }
-
- return 0;
-}
-
/**
* \brief Loads (from disk) the element content
* when a string is not suitable
Program: gdcm
Module: $RCSfile: gdcmDocument.h,v $
Language: C++
- Date: $Date: 2005/01/24 16:44:54 $
- Version: $Revision: 1.100 $
+ Date: $Date: 2005/01/25 15:44:24 $
+ Version: $Revision: 1.101 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// Content entries
-// Oops ! Python is gonna cry :
-// 4 methods with same name and different parameters ...
-// Only C++ is aware!
-
- virtual bool SetEntryValue(std::string const &content,
- uint16_t group, uint16_t elem);
- virtual bool SetEntryBinArea(uint8_t *content, int lgth,
- uint16_t group, uint16_t elem);
- virtual bool SetEntryValue(std::string const &content, ValEntry *entry);
- virtual bool SetEntryBinArea(uint8_t *content, int lgth, BinEntry *entry);
-
- virtual void *GetEntryBinArea(uint16_t group, uint16_t elem);
-
- virtual std::string GetEntryVR(uint16_t group, uint16_t elem);
- virtual int GetEntryLength(uint16_t group, uint16_t elem);
-
- ValEntry *Insert(std::string const &value,
- uint16_t group, uint16_t elem,
- TagName const &vr = GDCM_UNKNOWN);
- BinEntry *Insert(uint8_t *binArea, int lgth,
- uint16_t group, uint16_t elem,
- TagName const &vr = GDCM_UNKNOWN);
- SeqEntry *Insert(uint16_t group, uint16_t elem);
-
- bool ReplaceIfExist(std::string const &value,
- uint16_t group, uint16_t elem );
-
virtual void LoadEntryBinArea(uint16_t group, uint16_t elem);
virtual void LoadEntryBinArea(BinEntry *entry);
void LoadDocEntrySafe(DocEntry *entry);
- /*TagDocEntryHT *BuildFlatHashTable();*/
/// Return the Transfer Syntax as a string
std::string GetTransferSyntaxName();
Program: gdcm
Module: $RCSfile: gdcmElementSet.cxx,v $
Language: C++
- Date: $Date: 2005/01/25 11:11:59 $
- Version: $Revision: 1.50 $
+ Date: $Date: 2005/01/25 15:44:24 $
+ Version: $Revision: 1.51 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
}
}
-/**
- * \brief retrieves a Dicom Element using (group, element)
- * @param group Group number of the searched Dicom Element
- * @param elem Element number of the searched Dicom Element
- * @return
- */
-DocEntry *ElementSet::GetDocEntry(uint16_t group, uint16_t elem)
-{
- TagKey key = DictEntry::TranslateToKey(group, elem);
- if ( !TagHT.count(key))
- {
- return NULL;
- }
- return TagHT.find(key)->second;
-}
-
-/**
- * \brief Same as \ref Document::GetDocEntry except it only
- * returns a result when the corresponding entry is of type
- * ValEntry.
- * @param group Group number of the searched Dicom Element
- * @param elem Element number of the searched Dicom Element
- * @return When present, the corresponding ValEntry.
- */
-ValEntry *ElementSet::GetValEntry(uint16_t group, uint16_t elem)
-{
- DocEntry *currentEntry = GetDocEntry(group, elem);
- if ( !currentEntry )
- {
- return 0;
- }
- if ( ValEntry *entry = dynamic_cast<ValEntry*>(currentEntry) )
- {
- return entry;
- }
- gdcmVerboseMacro( "Unfound ValEntry.");
-
- return 0;
-}
-
-/**
- * \brief Same as \ref Document::GetDocEntry except it only
- * returns a result when the corresponding entry is of type
- * BinEntry.
- * @param group Group number of the searched Dicom Element
- * @param elem Element number of the searched Dicom Element
- * @return When present, the corresponding BinEntry.
- */
-BinEntry *ElementSet::GetBinEntry(uint16_t group, uint16_t elem)
-{
- DocEntry *currentEntry = GetDocEntry(group, elem);
- if ( !currentEntry )
- {
- return 0;
- }
- if ( BinEntry *entry = dynamic_cast<BinEntry*>(currentEntry) )
- {
- return entry;
- }
- gdcmVerboseMacro( "Unfound BinEntry.");
-
- return 0;
-}
-
-/**
- * \brief Same as \ref Document::GetDocEntry except it only
- * returns a result when the corresponding entry is of type
- * SeqEntry.
- * @param group Group number of the searched Dicom Element
- * @param elem Element number of the searched Dicom Element
- * @return When present, the corresponding SeqEntry.
- */
-SeqEntry *ElementSet::GetSeqEntry(uint16_t group, uint16_t elem)
-{
- DocEntry *currentEntry = GetDocEntry(group, elem);
- if ( !currentEntry )
- {
- return 0;
- }
- if ( SeqEntry *entry = dynamic_cast<SeqEntry*>(currentEntry) )
- {
- return entry;
- }
- gdcmVerboseMacro( "Unfound SeqEntry.");
-
- return 0;
-}
-
-/**
- * \brief Checks if a given Dicom Element exists within the H table
- * @param group Group number of the searched Dicom Element
- * @param elem Element number of the searched Dicom Element
- * @return true is found
- */
-bool ElementSet::CheckIfEntryExist(uint16_t group, uint16_t elem )
-{
- const std::string &key = DictEntry::TranslateToKey(group, elem );
- return TagHT.count(key) != 0;
-}
-
-/**
- * \brief Get the (std::string representable) value of the Dicom entry
- * @param group Group number of the searched tag.
- * @param elem Element number of the searched tag.
- * @return Corresponding element value when it exists,
- * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
- */
-std::string ElementSet::GetEntryValue(uint16_t group, uint16_t elem)
-{
- TagKey key = DictEntry::TranslateToKey(group, elem);
- if ( !TagHT.count(key))
- {
- return GDCM_UNFOUND;
- }
-
- return ((ValEntry *)TagHT.find(key)->second)->GetValue();
-}
-
/**
* \brief delete all entries in the ElementSet
*/
}
/**
- * \brief Get the larst entry while visiting the DocEntrySet
- * \return The last DocEntry if found, otherwhise NULL
- */
-DocEntry *ElementSet::GetLastEntry()
-{
- ItTagHT = TagHT.end();
- if ( ItTagHT != TagHT.begin() )
- return ItTagHT->second;
- return NULL;
-}
-
-/**
- * \brief Get the previous entry while visiting the Hash table (TagHT)
- * \note : meaningfull only if GetFirstEntry already called
- * \return The previous DocEntry if found, otherwhise NULL
+ * \brief retrieves a Dicom Element using (group, element)
+ * @param group Group number of the searched Dicom Element
+ * @param elem Element number of the searched Dicom Element
+ * @return
*/
-DocEntry *ElementSet::GetPreviousEntry()
+DocEntry *ElementSet::GetDocEntry(uint16_t group, uint16_t elem)
{
- gdcmAssertMacro (ItTagHT != TagHT.begin());
+ TagKey key = DictEntry::TranslateToKey(group, elem);
+ TagDocEntryHT::iterator it = TagHT.find(key);
- --ItTagHT;
- if (ItTagHT != TagHT.begin())
- return ItTagHT->second;
+ if ( it!=TagHT.end() )
+ return it->second;
return NULL;
}
Program: gdcm
Module: $RCSfile: gdcmElementSet.h,v $
Language: C++
- Date: $Date: 2005/01/25 11:11:59 $
- Version: $Revision: 1.37 $
+ Date: $Date: 2005/01/25 15:44:24 $
+ Version: $Revision: 1.38 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
virtual void Print(std::ostream &os = std::cout, std::string const &indent = "" );
+ void WriteContent(std::ofstream *fp, FileType filetype);
+
void ClearEntry();
bool AddEntry(DocEntry *Entry);
bool RemoveEntry(DocEntry *EntryToRemove);
bool RemoveEntryNoDestroy(DocEntry *EntryToRemove);
- void WriteContent(std::ofstream *fp, FileType filetype);
-
DocEntry *GetFirstEntry();
DocEntry *GetNextEntry();
- DocEntry *GetLastEntry();
- DocEntry *GetPreviousEntry();
DocEntry *GetDocEntry(uint16_t group, uint16_t elem);
- ValEntry *GetValEntry(uint16_t group, uint16_t elem);
- BinEntry *GetBinEntry(uint16_t group, uint16_t elem);
- SeqEntry *GetSeqEntry(uint16_t group, uint16_t elem);
bool IsEmpty() { return TagHT.empty(); };
- bool CheckIfEntryExist(uint16_t group, uint16_t elem);
-
- std::string GetEntryValue(uint16_t group, uint16_t elem);
- int GetEntryLength(uint16_t group, uint16_t elem);
- std::string GetEntryVR(uint16_t group, uint16_t elem);
-
- bool SetEntryValue(std::string const& content,
- uint16_t group, uint16_t elem);
protected:
Program: gdcm
Module: $RCSfile: gdcmFile.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 16:44:54 $
- Version: $Revision: 1.199 $
+ Date: $Date: 2005/01/25 15:44:24 $
+ Version: $Revision: 1.200 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// Bits Allocated
if ( GetEntryValue(0x0028,0x0100) == "12")
{
- SetEntryValue("16", 0x0028,0x0100);
+ SetValEntry("16", 0x0028,0x0100);
}
/// \todo correct 'Pixel group' Length if necessary
// no (GrPixel, NumPixel) element
std::string s_lgPix = Util::Format("%d", i_lgPix+12);
s_lgPix = Util::DicomString( s_lgPix.c_str() );
- Insert(s_lgPix,GrPixel, 0x0000);
+ InsertValEntry(s_lgPix,GrPixel, 0x0000);
}
// FIXME : should be nice if we could move it to File
bool File::AnonymizeFile()
{
// If exist, replace by spaces
- SetEntryValue (" ",0x0010, 0x2154); // Telephone
- SetEntryValue (" ",0x0010, 0x1040); // Adress
- SetEntryValue (" ",0x0010, 0x0020); // Patient ID
+ SetValEntry (" ",0x0010, 0x2154); // Telephone
+ SetValEntry (" ",0x0010, 0x1040); // Adress
+ SetValEntry (" ",0x0010, 0x0020); // Patient ID
DocEntry* patientNameHE = GetDocEntry (0x0010, 0x0010);
std::string studyInstanceUID = GetEntryValue (0x0020, 0x000d);
if ( studyInstanceUID != GDCM_UNFOUND )
{
- Insert(studyInstanceUID, 0x0010, 0x0010);
+ InsertValEntry(studyInstanceUID, 0x0010, 0x0010);
}
else
{
- Insert("anonymised", 0x0010, 0x0010);
+ InsertValEntry("anonymised", 0x0010, 0x0010);
}
}
// Special case this is the image (not a string)
GrPixel = 0x7fe0;
NumPixel = 0x0010;
- Insert(0, 0, GrPixel, NumPixel);
+ InsertBinEntry(0, 0, GrPixel, NumPixel);
// All remaining strings:
unsigned int i = 0;
DICOM_DEFAULT_VALUE current = defaultvalue[i];
while( current.value )
{
- Insert(current.value, current.group, current.elem);
+ InsertValEntry(current.value, current.group, current.elem);
current = defaultvalue[++i];
}
}
Program: gdcm
Module: $RCSfile: gdcmFileHelper.cxx,v $
Language: C++
- Date: $Date: 2005/01/25 15:21:20 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2005/01/25 15:44:24 $
+ Version: $Revision: 1.7 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* @param group group number of the Dicom Element to modify
* @param elem element number of the Dicom Element to modify
*/
-bool FileHelper::SetEntryValue(std::string const &content,
+bool FileHelper::SetValEntry(std::string const &content,
uint16_t group, uint16_t elem)
{
- return FileInternal->SetEntryValue(content,group,elem);
+ return FileInternal->SetValEntry(content,group,elem);
}
* @param group group number of the Dicom Element to modify
* @param elem element number of the Dicom Element to modify
*/
-bool FileHelper::SetEntryBinArea(uint8_t *content, int lgth,
+bool FileHelper::SetBinEntry(uint8_t *content, int lgth,
uint16_t group, uint16_t elem)
{
- return FileInternal->SetEntryBinArea(content,lgth,group,elem);
+ return FileInternal->SetBinEntry(content,lgth,group,elem);
}
/**
* \return pointer to the modified/created Dicom entry (NULL when creation
* failed).
*/
-bool FileHelper::Insert(std::string const &content,
- uint16_t group, uint16_t elem)
+ValEntry *FileHelper::InsertValEntry(std::string const &content,
+ uint16_t group, uint16_t elem)
{
- return FileInternal->Insert(content,group,elem) != NULL;
+ return FileInternal->InsertValEntry(content,group,elem);
}
/*
* \return pointer to the modified/created Dicom entry (NULL when creation
* failed).
*/
-bool FileHelper::Insert(uint8_t *binArea, int lgth,
- uint16_t group, uint16_t elem)
+BinEntry *FileHelper::InsertBinEntry(uint8_t *binArea, int lgth,
+ uint16_t group, uint16_t elem)
{
- return FileInternal->Insert(binArea,lgth,group,elem) != NULL;
+ return FileInternal->InsertBinEntry(binArea,lgth,group,elem);
+}
+
+/*
+ * \brief Modifies the value of a given DocEntry (Dicom entry)
+ * when it exists. Create it with the given value when unexistant.
+ * A copy of the binArea is made to be kept in the Document.
+ * @param group Group number of the Entry
+ * @param elem Element number of the Entry
+ * \return pointer to the modified/created Dicom entry (NULL when creation
+ * failed).
+ */
+SeqEntry *FileHelper::InsertSeqEntry(uint16_t group, uint16_t elem)
+{
+ return FileInternal->InsertSeqEntry(group,elem);
}
/**
Program: gdcm
Module: $RCSfile: gdcmFileHelper.h,v $
Language: C++
- Date: $Date: 2005/01/24 16:44:54 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2005/01/25 15:44:24 $
+ Version: $Revision: 1.7 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
class File;
class ValEntry;
class BinEntry;
+class SeqEntry;
class PixelReadConvert;
class PixelWriteConvert;
class DocEntryArchive;
void Print(std::ostream &os = std::cout, std::string const & indent = "");
+ // File methods
+ bool SetValEntry(std::string const &content,
+ uint16_t group, uint16_t elem);
+ bool SetBinEntry(uint8_t *content, int lgth,
+ uint16_t group, uint16_t elem);
+
+ ValEntry *InsertValEntry(std::string const &content,
+ uint16_t group, uint16_t elem);
+ BinEntry *InsertBinEntry(uint8_t *binArea, int lgth,
+ uint16_t group, uint16_t elem);
+ SeqEntry *InsertSeqEntry(uint16_t group, uint16_t elem);
+
/// Accessor to \ref File
File *GetFile() { return FileInternal; }
bool WriteAcr (std::string const &fileName);
bool Write (std::string const &fileName);
- bool SetEntryValue(std::string const &content,
- uint16_t group, uint16_t elem);
- bool SetEntryBinArea(uint8_t *content, int lgth,
- uint16_t group, uint16_t elem);
- bool Insert(std::string const &content,
- uint16_t group, uint16_t elem);
- bool Insert(uint8_t *binArea, int lgth,
- uint16_t group, uint16_t elem);
-
uint8_t* GetLutRGBA();
// Write mode
Program: gdcm
Module: $RCSfile: gdcmSQItem.cxx,v $
Language: C++
- Date: $Date: 2005/01/25 11:11:59 $
- Version: $Revision: 1.59 $
+ Date: $Date: 2005/01/25 15:44:24 $
+ 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
return true;
}
-/**
- * \brief Sets Entry (Dicom Element) value of an element,
- * specified by it's tag (Group, Number)
- * and the length, too ... inside a SQ Item
- * If the Element is not found, it's just created !
- * \warning we suppose, right now, the element belongs to a Public Group
- * (NOT a shadow one)
- * @param val string value to set
- * @param group Group number of the searched tag.
- * @param elem Element number of the searched tag.
- * @return true if element was found or created successfully
- */
-
-bool SQItem::SetEntryValue(std::string const &val, uint16_t group,
- uint16_t elem)
-{
- for(ListDocEntry::iterator i = DocEntries.begin();
- i != DocEntries.end();
- ++i)
- {
- if ( (*i)->GetGroup() == 0xfffe && (*i)->GetElement() == 0xe000 )
- {
- continue;
- }
-
- if ( ( group < (*i)->GetGroup() )
- ||( group == (*i)->GetGroup() && elem < (*i)->GetElement()) )
- {
- // instead of Insert, that is a method of Document :-(
- ValEntry* entry = 0;
- TagKey key = DictEntry::TranslateToKey(group, elem);
-
- // we assume a Public Dictionary *is* loaded
- Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
- // if the invoked (group,elem) doesn't exist inside the Dictionary
- // we create a VirtualDictEntry
- DictEntry *dictEntry = pubDict->GetEntry(group, elem);
- if (dictEntry == NULL)
- {
- dictEntry =
- Global::GetDicts()->NewVirtualDictEntry(group, elem,
- "UN", GDCM_UNKNOWN,
- GDCM_UNKNOWN);
- }
- // we assume the constructor didn't fail
- entry = new ValEntry(dictEntry);
- if (entry)
- {
- entry->SetValue(val);
- }
- DocEntries.insert(i,entry);
-
- return true;
- }
- if (group == (*i)->GetGroup() && elem == (*i)->GetElement() )
- {
- if ( ValEntry *entry = dynamic_cast<ValEntry*>(*i) )
- {
- entry->SetValue(val);
- }
- return true;
- }
- }
- return false;
-}
-
/**
* \brief Clear the std::list from given entry AND delete the entry.
* @param entryToRemove Entry to remove AND delete.
}
}
-//-----------------------------------------------------------------------------
-// Protected
/**
* \brief Gets a Dicom Element inside a SQ Item Entry
* @param group Group number of the Entry
for(ListDocEntry::iterator i = DocEntries.begin();
i != DocEntries.end(); ++i)
{
- if ( (*i)->GetGroup() == group && (*i)->GetElement() == elem )
- {
+ if ( (*i)->GetGroup()==group && (*i)->GetElement()==elem )
return *i;
- }
}
- return 0;
-}
-
-/**
- * \brief Gets a Dicom Element inside a SQ Item Entry
- * @param group Group number of the Entry
- * @param elem Element number of the Entry
- * @return Entry whose (group,elem) was passed. 0 if not found
- */
-ValEntry* SQItem::GetValEntry(uint16_t group, uint16_t elem)
-{
- DocEntry *d = GetDocEntry(group, elem);
- if ( ValEntry *e = dynamic_cast<ValEntry*>(d) )
- return e;
- return 0;
-}
-
-/**
- * \brief Gets a Dicom Element inside a SQ Item Entry
- * @param group Group number of the Entry
- * @param elem Element number of the Entry
- * @return Entry whose (group,elem) was passed. 0 if not found
- */
-BinEntry* SQItem::GetBinEntry(uint16_t group, uint16_t elem)
-{
- DocEntry *d = GetDocEntry(group, elem);
- if ( BinEntry *e = dynamic_cast<BinEntry*>(d) )
- return e;
- return 0;
-}
-
-/**
- * \brief Gets a Dicom Element inside a SQ Item Entry
- * @param group Group number of the Entry
- * @param elem Element number of the Entry
- * @return Entry whose (group,elem) was passed. 0 if not found
- */
-SeqEntry* SQItem::GetSeqEntry(uint16_t group, uint16_t elem)
-{
- DocEntry *d = GetDocEntry(group, elem);
- if ( SeqEntry *e = dynamic_cast<SeqEntry*>(d) )
- return e;
- return 0;
+ return NULL;
}
+//-----------------------------------------------------------------------------
+// Protected
-/**
- * \brief Get the value of a Dicom Element inside a SQ Item Entry
- * \note : meaningfull only if the required entry is NEITHER a SeqEntry
- * NOR a BinEntry
- * @param group Group number of the Entry
- * @param elem Element number of the Entry
- * @return 'string value' of the entry whose (group,elem) was passed.
- * GDCM_UNFOUND if not found
- */
-
-std::string SQItem::GetEntryValue(uint16_t group, uint16_t elem)
-{
-
-/*
- DocEntry *e = GetFirstEntry();
- while (e)
- {
- if ( e->GetGroup() == group && e->GetElement() == elem)
- {
-
- if (ValEntry *ve = dynamic_cast<ValEntry*>(e))
- return ve->GetValue();
- }
- e = GetNextEntry();
- }
-*/
- for(ListDocEntry::iterator i = DocEntries.begin();
- i != DocEntries.end(); ++i)
- {
- if ( (*i)->GetGroup() == group && (*i)->GetElement() == elem)
- {
- if (ValEntry *ve = dynamic_cast<ValEntry*>(*i))
- return ve->GetValue();
- }
- }
- return GDCM_UNFOUND;
-}
//-----------------------------------------------------------------------------
// Private
Program: gdcm
Module: $RCSfile: gdcmSQItem.h,v $
Language: C++
- Date: $Date: 2005/01/25 11:11:59 $
- Version: $Revision: 1.36 $
+ Date: $Date: 2005/01/25 15:44:24 $
+ Version: $Revision: 1.37 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
virtual void Print(std::ostream &os = std::cout, std::string const & indent = "" );
void WriteContent(std::ofstream *fp, FileType filetype);
- /// \brief returns the DocEntry chained List for this SQ Item.
- ListDocEntry const &GetDocEntries() const { return DocEntries; };
-
void ClearEntry();
bool AddEntry(DocEntry *Entry); // add to the List
bool RemoveEntry(DocEntry *EntryToRemove);
bool RemoveEntryNoDestroy(DocEntry *EntryToRemove);
+ DocEntry *GetFirstEntry();
+ DocEntry *GetNextEntry();
+
DocEntry *GetDocEntry(uint16_t group, uint16_t elem);
- ValEntry *GetValEntry(uint16_t group, uint16_t elem);
- BinEntry *GetBinEntry(uint16_t group, uint16_t elem);
- SeqEntry *GetSeqEntry(uint16_t group, uint16_t elem);
-
- bool SetEntryValue(std::string const &val, uint16_t group,
- uint16_t elem);
-
- std::string GetEntryValue(uint16_t group, uint16_t elem);
+
+ bool IsEmpty() { return DocEntries.empty(); };
/// \brief returns the ordinal position of a given SQItem
int GetSQItemNumber() { return SQItemNumber; };
-
/// \brief Sets the ordinal position of a given SQItem
void SetSQItemNumber(int itemNumber) { SQItemNumber = itemNumber; };
/// \brief Accessor on \ref SQDepthLevel.
- int GetDepthLevel() { return SQDepthLevel; }
-
+ int GetDepthLevel() { return SQDepthLevel; }
/// \brief Accessor on \ref SQDepthLevel.
void SetDepthLevel(int depth) { SQDepthLevel = depth; }
/// \brief Accessor on \ref BaseTagKey.
BaseTagKey const &GetBaseTagKey() const { return BaseTagKeyNested; }
- DocEntry *GetFirstEntry();
- DocEntry *GetNextEntry();
-
protected:
// Variables that need to be access in subclasses
-
/// \brief Chained list of (Elementary) Doc Entries
ListDocEntry DocEntries;
/// Chained list iterator, used to visit the TagHT variable
ListDocEntry::iterator ItDocEntries;
- /// \brief pointer to the HTable of the Document,
- /// (because we don't know it within any DicomDirObject nor any SQItem)
- // TagDocEntryHT *PtagHT;
-
private:
-
/// \brief Sequences can be nested. This \ref SQDepthLevel represents
/// the level of the nesting of instances of this class.
/// \ref SQDepthLevel and its \ref SeqEntry::SQDepthLevel
Program: gdcm
Module: $RCSfile: vtkGdcmWriter.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 16:51:01 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2005/01/25 15:44:25 $
+ 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
#include <vtkPointData.h>
#include <vtkLookupTable.h>
-vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.14 $");
+vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.15 $");
vtkStandardNewMacro(vtkGdcmWriter);
//-----------------------------------------------------------------------------
str.str("");
str << dim[0];
- file->Insert(str.str(),0x0028,0x0011); // Columns
+ file->InsertValEntry(str.str(),0x0028,0x0011); // Columns
str.str("");
str << dim[1];
- file->Insert(str.str(),0x0028,0x0010); // Rows
+ file->InsertValEntry(str.str(),0x0028,0x0010); // Rows
if(dim[2]>1)
{
str.str("");
str << dim[2];
//file->Insert(str.str(),0x0028,0x0012); // Planes
- file->Insert(str.str(),0x0028,0x0008); // Number of Frames
+ file->InsertValEntry(str.str(),0x0028,0x0008); // Number of Frames
}
// Pixel type
str.str("");
str << image->GetScalarSize()*8;
- file->Insert(str.str(),0x0028,0x0100); // Bits Allocated
- file->Insert(str.str(),0x0028,0x0101); // Bits Stored
+ file->InsertValEntry(str.str(),0x0028,0x0100); // Bits Allocated
+ file->InsertValEntry(str.str(),0x0028,0x0101); // Bits Stored
str.str("");
str << image->GetScalarSize()*8-1;
- file->Insert(str.str(),0x0028,0x0102); // High Bit
+ file->InsertValEntry(str.str(),0x0028,0x0102); // High Bit
// Pixel Repr
// FIXME : what do we do when the ScalarType is
{
str << "1"; // Signed
}
- file->Insert(str.str(),0x0028,0x0103); // Pixel Representation
+ file->InsertValEntry(str.str(),0x0028,0x0103); // Pixel Representation
// Samples per pixel
str.str("");
str << image->GetNumberOfScalarComponents();
- file->Insert(str.str(),0x0028,0x0002); // Samples per Pixel
+ file->InsertValEntry(str.str(),0x0028,0x0002); // Samples per Pixel
// Spacing
double *sp = image->GetSpacing();
str.str("");
str << sp[0] << "\\" << sp[1];
- file->Insert(str.str(),0x0028,0x0030); // Pixel Spacing
+ file->InsertValEntry(str.str(),0x0028,0x0030); // Pixel Spacing
str.str("");
str << sp[2];
- file->Insert(str.str(),0x0018,0x0088); // Spacing Between Slices
+ file->InsertValEntry(str.str(),0x0018,0x0088); // Spacing Between Slices
// Origin
double *org = image->GetOrigin();
str.str("");
str << org[0] << "\\" << org[1] << "\\" << org[2];
- file->Insert(str.str(),0x0020,0x0032); // Image Position Patient
+ file->InsertValEntry(str.str(),0x0020,0x0032); // Image Position Patient
// Window / Level
double *rng=image->GetScalarRange();
str.str("");
str << rng[1]-rng[0];
- file->Insert(str.str(),0x0028,0x1051); // Window Width
+ file->InsertValEntry(str.str(),0x0028,0x1051); // Window Width
str.str("");
str << (rng[1]+rng[0])/2.0;
- file->Insert(str.str(),0x0028,0x1050); // Window Center
+ file->InsertValEntry(str.str(),0x0028,0x1050); // Window Center
// Pixels
unsigned char *data;