User tells gdcm *where* it is.
File::SetFourthDimensionLocation(groupNb, elementNb);
After Load(), he may use int File::GetTSize();
As a proof of concept, PrintFile has one more option :
4Dloc=0x3001-0x1001, for instance.
One can see pixel size is now computed properly.
(VTK stuff is still missing)
--> Later!
Module: $RCSfile: gdcmFileHelper.cxx,v $
Language: C++
- Date: $Date: 2006/03/13 14:44:07 $
- Version: $Revision: 1.97 $
+ Date: $Date: 2006/03/29 16:09:48 $
+ Version: $Revision: 1.98 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
size_t decSize = FileInternal->GetXSize()
* FileInternal->GetYSize()
* FileInternal->GetZSize()
+ * FileInternal->GetTSize()
* FileInternal->GetSamplesPerPixel()
* ( numberBitsAllocated / 8 );
size_t rgbSize = decSize;
Program: gdcm
Module: $RCSfile: gdcmFileHelper.h,v $
Language: C++
- Date: $Date: 2006/03/01 15:32:52 $
- Version: $Revision: 1.40 $
+ Date: $Date: 2006/03/29 16:09:48 $
+ 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
#include "gdcmDebug.h"
#include "gdcmRefCounter.h"
-
+#include "gdcmFile.h"
namespace gdcm
{
-class File;
+//class File;
class DataEntry;
class SeqEntry;
class PixelReadConvert;
/// (as opposed to 'Grey pixels + Palettes color')
void SetWriteModeToRGB() { SetWriteMode(WMODE_RGB); }
/// \brief Sets the Write Mode ( )
- void SetWriteMode(FileMode mode) { WriteMode = mode; }
+ void SetWriteMode(FileMode mode) {
+ WriteMode = mode;
+ // Deal with Samples per Pixel
+ //if (mode == WMODE_RGB) FileInternal->InsertEntryString("3",0x0028,0x0002);
+ }
/// \brief Gets the Write Mode ( )
FileMode GetWriteMode() { return WriteMode; }
Program: gdcm
Module: $RCSfile: gdcmPixelReadConvert.cxx,v $
Language: C++
- Date: $Date: 2006/02/16 20:06:14 $
- Version: $Revision: 1.110 $
+ Date: $Date: 2006/03/29 16:09:48 $
+ Version: $Revision: 1.111 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
XSize = file->GetXSize();
YSize = file->GetYSize();
ZSize = file->GetZSize();
+ TSize = file->GetTSize();
SamplesPerPixel = file->GetSamplesPerPixel();
//PixelSize = file->GetPixelSize(); Useless
PixelSign = file->IsSignedPixelData();
else if ( IsRLELossless )
{
if ( ! RLEInfo->DecompressRLEFile
- ( fp, Raw, XSize, YSize, ZSize, BitsAllocated ) )
+ ( fp, Raw, XSize, YSize, ZSize, TSize, BitsAllocated ) )
{
gdcmWarningMacro( "RLE decompressor failed." );
return false;
void PixelReadConvert::ReadAndDecompress12BitsTo16Bits( std::ifstream *fp )
throw ( FormatError )
{
- int nbPixels = XSize * YSize;
+ /// \todo Fix the 3D, 4D pb
+ int nbPixels = XSize * YSize * TSize;
uint16_t *localDecompres = (uint16_t*)Raw;
for( int p = 0; p < nbPixels; p += 2 )
// make sure this is the right JPEG compression
assert( !IsJPEGLS || !IsJPEG2000 );
// Precompute the offset localRaw will be shifted with
- int length = XSize * YSize * SamplesPerPixel;
+ int length = XSize * YSize * ZSize * SamplesPerPixel;
int numberBytes = BitsAllocated / 8;
JPEGInfo->DecompressFromFile(fp, Raw, BitsStored, numberBytes, length );
// ftp://medical.nema.org/medical/dicom/final/sup61_ft.pdf
// and be *very* affraid
//
- int l = XSize * YSize;
+
+ /// \todo : find an example to see how 3rd dim and 4th dim work together
+ int l = XSize * YSize * TSize;
int nbFrames = ZSize;
uint8_t *a = copyRaw + 0;
bitsAllocated = 16;
}
- RawSize = XSize * YSize * ZSize
+ RawSize = XSize * YSize * ZSize * TSize
* ( bitsAllocated / 8 )
* SamplesPerPixel;
if ( HasLUT )
Program: gdcm
Module: $RCSfile: gdcmPixelReadConvert.h,v $
Language: C++
- Date: $Date: 2006/02/16 20:06:15 $
- Version: $Revision: 1.29 $
+ Date: $Date: 2006/03/29 16:09:48 $
+ 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
int XSize;
int YSize;
int ZSize;
+ int TSize;
int BitsAllocated;
int BitsStored;
int HighBitPosition;
Program: gdcm
Module: $RCSfile: gdcmRLEFramesInfo.cxx,v $
Language: C++
- Date: $Date: 2006/01/27 10:01:34 $
- Version: $Revision: 1.20 $
+ Date: $Date: 2006/03/29 16:09:48 $
+ 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
* @param xSize x Size
* @param ySize y Size
* @param zSize z Size
+ * @param tSize t Size
* @param bitsAllocated Bits allocated
* @return Boolean
*/
bool RLEFramesInfo::DecompressRLEFile( std::ifstream *fp , uint8_t *raw,
int xSize, int ySize, int zSize,
- int bitsAllocated )
+ int tSize, int bitsAllocated )
{
uint8_t *subRaw = raw;
- long rawSegmentSize = xSize * ySize;
+ long rawSegmentSize = xSize * ySize * tSize;
// Loop on the frame[s]
for(RLEFrameList::iterator it = Frames.begin(); it != Frames.end(); ++it)
if ( bitsAllocated == 16 )
{
// Try to deal with RLE 16 Bits
- ConvertRLE16BitsFromRLE8Bits( raw, xSize, ySize, zSize );
+ ConvertRLE16BitsFromRLE8Bits( raw, xSize, ySize, zSize, tSize );
}
return true;
* @param raw raw
* @param xSize x Size
* @param ySize y Size
+ * @param tSize t Size
* @param numberOfFrames number of frames
* @return Boolean always true
*/
bool RLEFramesInfo::ConvertRLE16BitsFromRLE8Bits(uint8_t *raw, int xSize,
- int ySize, int numberOfFrames)
+ int ySize, int tSize,
+ int numberOfFrames)
{
- size_t pixelNumber = xSize * ySize;
+ size_t pixelNumber = xSize * ySize * tSize;
size_t rawSize = pixelNumber * numberOfFrames * 2;
// We assumed Raw contains the decoded RLE pixels but as
<< "Total number of Frames : " << Frames.size()
<< std::endl;
int frameNumber = 0;
+ /// \todo : find an example, to know haow 3rd and 4th dimension
+ /// works together
for(RLEFrameList::iterator it = Frames.begin(); it != Frames.end(); ++it)
{
os << indent
Program: gdcm
Module: $RCSfile: gdcmRLEFramesInfo.h,v $
Language: C++
- Date: $Date: 2006/02/16 20:06:15 $
- Version: $Revision: 1.21 $
+ Date: $Date: 2006/03/29 16:09:48 $
+ 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
~RLEFramesInfo();
void Print( std::ostream &os = std::cout, std::string indent = "" );
bool DecompressRLEFile( std::ifstream *fp, uint8_t *subRaw, int xSize,
- int ySize, int zSize, int bitsAllocated );
- bool ConvertRLE16BitsFromRLE8Bits( uint8_t *subRaw, int xSize, int ySize,
- int numberOfFrames );
+ int ySize, int zSize, int tSize, int bitsAllocated );
+ bool ConvertRLE16BitsFromRLE8Bits( uint8_t *subRaw, int xSize, int ySize,
+ int tSize, int numberOfFrames);
void AddFrame(RLEFrame *frame);