Program: gdcm
Module: $RCSfile: TestWriteSimple.cxx,v $
Language: C++
- Date: $Date: 2004/12/10 21:32:11 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2005/01/20 16:16:59 $
+ 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
*
*/
#include "gdcmHeader.h"
-#include "gdcmFile.h"
+#include "gdcmFileHelper.h"
#include <iostream>
+#include <sstream>
typedef struct
{
// Set the image size
str.str("");
str << img.sizeX;
- header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0011); // Columns
+ header->ReplaceOrCreate(str.str(),0x0028,0x0011); // Columns
str.str("");
str << img.sizeY;
- header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0010); // Rows
+ header->ReplaceOrCreate(str.str(),0x0028,0x0010); // Rows
if(img.sizeZ>1)
{
str.str("");
str << img.sizeZ;
- header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0008); // Number of Frames
+ header->ReplaceOrCreate(str.str(),0x0028,0x0008); // Number of Frames
}
// Set the pixel type
str.str("");
str << img.componentSize;
- header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0100); // Bits Allocated
+ header->ReplaceOrCreate(str.str(),0x0028,0x0100); // Bits Allocated
str.str("");
str << img.componentUse;
- header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0101); // Bits Stored
+ header->ReplaceOrCreate(str.str(),0x0028,0x0101); // Bits Stored
str.str("");
str << img.componentSize - 1;
- header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0102); // High Bit
+ header->ReplaceOrCreate(str.str(),0x0028,0x0102); // High Bit
// Set the pixel representation
str.str("");
str << img.sign;
- header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0103); // Pixel Representation
+ header->ReplaceOrCreate(str.str(),0x0028,0x0103); // Pixel Representation
// Set the samples per pixel
str.str("");
str << img.components;
- header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0002); // Samples per Pixel
+ header->ReplaceOrCreate(str.str(),0x0028,0x0002); // Samples per Pixel
if( !header->IsReadable() )
{
// Step 3 : Create the file of the image
std::cout << "3...";
- gdcm::File *file = new gdcm::File(header);
+ gdcm::FileHelper *file = new gdcm::FileHelper(header);
file->SetImageData(imageData,size);
// Step 4 : Set the writting mode and write the image
// Step 5 : Read the written image
std::cout << "5...";
- gdcm::File* reread = new gdcm::File( fileName );
+ gdcm::FileHelper* reread = new gdcm::FileHelper( fileName );
if( !reread->GetHeader()->IsReadable() )
{
std::cerr << "Failed" << std::endl
// Step 6 : Compare to the written image
std::cout << "6...";
- int dataSizeWritten = reread->GetImageDataSize();
+ size_t dataSizeWritten = reread->GetImageDataSize();
uint8_t* imageDataWritten = reread->GetImageData();
// Test the image size