using System;
public class ExtractImageRegion
{
public static int Main(string[] args)
{
string filename = args[0];
byte[] buffer = new byte[ dims[0] * dims[1] * pixelsize ];
byte[] buffer2 = new byte[ dims[0] * dims[1] * pixelsize * 3 ];
for (uint z = 0; z < dims[2]; z++)
{
box.
SetDomain(0, dims[0] - 1, 0, dims[1] - 1, z, z);
{
if( !lut.
Decode( buffer2, (uint)buffer2.Length, buffer, (uint)buffer.Length ) )
{
}
using (System.IO.Stream stream =
System.IO.File.Open(
@"/tmp/frame_rgb.raw",
{
System.IO.BinaryWriter writer =
new System.IO.BinaryWriter(stream);
writer.Write(buffer2);
}
}
else
{
throw new Exception(
"can't read pixels error");
}
}
return 0;
}
}
const LookupTable & GetLUT() const
Definition gdcmBitmap.h:87
Class for manipulation box region.
Definition gdcmBoxRegion.h:31
void SetDomain(unsigned int xmin, unsigned int xmax, unsigned int ymin, unsigned int ymax, unsigned int zmin, unsigned int zmax)
Set domain.
Exception.
Definition gdcmException.h:44
a DICOM File
Definition gdcmFile.h:34
ImageHelper (internal class, not intended for user level)
Definition gdcmImageHelper.h:60
static std::vector< unsigned int > GetDimensionsValue(const File &f)
const Image & GetImage() const
Return the read image.
ImageRegionReader.
Definition gdcmImageRegionReader.h:35
bool ReadIntoBuffer(char *inreadbuffer, size_t buflen)
void SetRegion(Region const ®ion)
Set/Get Region to be read.
LookupTable class.
Definition gdcmLookupTable.h:30
void Decode(std::istream &is, std::ostream &os) const
Decode the LUT.
const File & GetFile() const
Set/Get File.
Definition gdcmReader.h:72
void SetFileName(const char *filename_native)
Class to do system operation.
Definition gdcmSystem.h:27