Program: gdcm
Module: $RCSfile: gdcmFileHelper.cxx,v $
Language: C++
- Date: $Date: 2005/01/21 11:40:55 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2005/01/26 16:28:58 $
+ 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
#include "gdcmDebug.h"
#include "gdcmUtil.h"
#include "gdcmBinEntry.h"
+#include "gdcmValEntry.h"
+#include "gdcmContentEntry.h"
#include "gdcmFile.h"
#include "gdcmPixelReadConvert.h"
#include "gdcmPixelWriteConvert.h"
* 'image' Pixels are presented as C-like 2D arrays : line per line.
* 'volume'Pixels are presented as C-like 3D arrays : plane per plane
* \warning Since the pixels are not copied, it is the caller's responsability
- * not to deallocate it's data before gdcm uses them (e.g. with
+ * not to deallocate its data before gdcm uses them (e.g. with
* the Write() method.
* @param inData user supplied pixel area
* @param expectedSize total image size, in Bytes
}
/**
- * \brief Set the image datas defined by the user
- * \warning When writting the file, this datas are get as default datas to write
+ * \brief Set the image data defined by the user
+ * \warning When writting the file, this data are get as default data to write
*/
void FileHelper::SetUserData(uint8_t *data, size_t expectedSize)
{
}
/**
- * \brief Get the image datas defined by the user
- * \warning When writting the file, this datas are get as default data to write
+ * \brief Get the image data defined by the user
+ * \warning When writting the file, this data are get as default data to write
*/
uint8_t *FileHelper::GetUserData()
{
/**
* \brief Get the image data size defined by the user
- * \warning When writting the file, this datas are get as default data to write
+ * \warning When writting the file, this data are get as default data to write
*/
size_t FileHelper::GetUserDataSize()
{
}
/**
- * \brief Get the image datas from the file.
+ * \brief Get the image data from the file.
* If a LUT is found, the data are expanded to be RGB
*/
uint8_t *FileHelper::GetRGBData()
}
/**
- * \brief Get the image datas from the file.
- * If a LUT is found, the datas are not expanded !
+ * \brief Get the image data from the file.
+ * If a LUT is found, the data are not expanded !
*/
uint8_t *FileHelper::GetRawData()
{
* 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 group group number of the Dicom Element to modify
* @param elem element number of the Dicom Element to modify
*/
-bool FileHelper::SetEntry(std::string const &content,
+bool FileHelper::SetValEntry(std::string const &content,
uint16_t group, uint16_t elem)
{
- return FileInternal->SetEntry(content,group,elem);
+ return FileInternal->SetValEntry(content,group,elem);
}
* 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 group group number of the Dicom Element to modify
* @param elem element number of the Dicom Element to modify
*/
-bool FileHelper::SetEntry(uint8_t *content, int lgth,
- uint16_t group, uint16_t elem)
+bool FileHelper::SetBinEntry(uint8_t *content, int lgth,
+ uint16_t group, uint16_t elem)
{
- return FileInternal->SetEntry(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::ReplaceOrCreate(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->ReplaceOrCreate(content,group,elem) != NULL;
+ return FileInternal->InsertValEntry(content,group,elem);
}
/*
* \return pointer to the modified/created Dicom entry (NULL when creation
* failed).
*/
-bool FileHelper::ReplaceOrCreate(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->ReplaceOrCreate(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);
}
/**
* The tests made are :
* - verify the size of the image to write with the possible write
* when the user set an image data
- * @return true if the check successfulls
+ * @return true if check is successfull
*/
bool FileHelper::CheckWriteIntegrity()
{
case WMODE_RAW :
if( decSize!=PixelWriteConverter->GetUserDataSize() )
{
- gdcmVerboseMacro( "Data size is incorrect (Raw)" << decSize
- << " / " << PixelWriteConverter->GetUserDataSize() );
+ gdcmVerboseMacro( "Data size (Raw) is incorrect. Should be "
+ << decSize << " / Found :"
+ << PixelWriteConverter->GetUserDataSize() );
return false;
}
break;
case WMODE_RGB :
if( rgbSize!=PixelWriteConverter->GetUserDataSize() )
{
- gdcmVerboseMacro( "Data size is incorrect (RGB)" << decSize
- << " / " << PixelWriteConverter->GetUserDataSize() );
+ gdcmVerboseMacro( "Data size (RGB) is incorrect. Should be "
+ << decSize << " / Found "
+ << PixelWriteConverter->GetUserDataSize() );
return false;
}
break;
/**
* \brief Modifies the value of a given Bin Entry (Dicom Element)
* when it exists. Create it with the given value when unexistant.
- * @param content (string) Value to be set
* @param group Group number of the Entry
* @param elem Element number of the Entry
* \return pointer to the modified/created Bin Entry (NULL when creation
if ( FileInternal->IsReadable() )
{
- PixelReadConverter->GrabInformationsFromHeader( FileInternal );
+ PixelReadConverter->GrabInformationsFromFile( FileInternal );
}
}