gdcmStreamImageWriter.h
Go to the documentation of this file.
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef GDCMSTREAMIMAGEWRITER_H
#define GDCMSTREAMIMAGEWRITER_H
#include "gdcmWriter.h"
#include <iostream>
#include "gdcmDataSet.h"
namespace gdcm
{
class MediaStorage;
class RAWCodec;
class GDCM_EXPORT StreamImageWriter
{
public:
StreamImageWriter();
virtual ~StreamImageWriter();
void SetFileName(const char* inFileName);
void SetStream(std::ostream& inStream);
void DefinePixelExtent(uint16_t inXMin, uint16_t inXMax,
uint16_t inYMin, uint16_t inYMax, uint16_t inZMin = 0, uint16_t inZMax = 1);
uint32_t DefineProperBufferLength();
bool Write(void* inWriteBuffer, const std::size_t& inBufferLength);
virtual bool WriteImageInformation();
bool CanWriteFile() const;
void SetFile(const File& inFile);
protected:
//contains the PrepareWrite function, which will get the given dataset ready
//for writing to disk by manufacturing the header information.
//note that if there is a pixel element in the given dataset, that will be removed
//during the copy, so that the imagewriter can write everything else out
Writer mWriter;
//is the offset necessary if we always append?
//std::streamoff mFileOffset; //the fileoffset for getting header information
SmartPointer<File> mspFile; //all the non-pixel information
//for thread safety, these should not be stored here, but should be used
//for every read subregion operation.
uint16_t mXMin, mYMin, mXMax, mYMax, mZMin, mZMax;
//virtual bool ReadImageSubregionRAW(std::ostream& os);
virtual bool WriteImageSubregionRAW(char* inWriteBuffer, const std::size_t& inBufferLength);
int WriteRawHeader(RAWCodec* inCodec, std::ostream* inStream);
int mElementOffsets;
int mElementOffsets1;
};
} // end namespace gdcm
#endif //GDCMSTREAMIMAGEWRITER_H
gdcm::File
a DICOM File
Definition gdcmFile.h:34
gdcm::MediaStorage
MediaStorage.
Definition gdcmMediaStorage.h:44
gdcm::RAWCodec
RAWCodec class.
Definition gdcmRAWCodec.h:27
gdcm::SmartPointer
Class for Smart Pointer.
Definition gdcmSmartPointer.h:40
gdcm::StreamImageWriter::StreamImageWriter
StreamImageWriter()
gdcm::StreamImageWriter::mZMin
uint16_t mZMin
Definition gdcmStreamImageWriter.h:113
gdcm::StreamImageWriter::mElementOffsets1
int mElementOffsets1
Definition gdcmStreamImageWriter.h:138
gdcm::StreamImageWriter::mXMax
uint16_t mXMax
Definition gdcmStreamImageWriter.h:113
gdcm::StreamImageWriter::SetFile
void SetFile(const File &inFile)
gdcm::StreamImageWriter::CanWriteFile
bool CanWriteFile() const
gdcm::StreamImageWriter::DefinePixelExtent
void DefinePixelExtent(uint16_t inXMin, uint16_t inXMax, uint16_t inYMin, uint16_t inYMax, uint16_t inZMin=0, uint16_t inZMax=1)
gdcm::StreamImageWriter::WriteRawHeader
int WriteRawHeader(RAWCodec *inCodec, std::ostream *inStream)
gdcm::StreamImageWriter::mXMin
uint16_t mXMin
Definition gdcmStreamImageWriter.h:113
gdcm::StreamImageWriter::mspFile
SmartPointer< File > mspFile
Definition gdcmStreamImageWriter.h:109
gdcm::StreamImageWriter::DefineProperBufferLength
uint32_t DefineProperBufferLength()
gdcm::StreamImageWriter::mWriter
Writer mWriter
Definition gdcmStreamImageWriter.h:105
gdcm::StreamImageWriter::~StreamImageWriter
virtual ~StreamImageWriter()
gdcm::StreamImageWriter::mYMin
uint16_t mYMin
Definition gdcmStreamImageWriter.h:113
gdcm::StreamImageWriter::mElementOffsets
int mElementOffsets
Definition gdcmStreamImageWriter.h:137
gdcm::StreamImageWriter::SetStream
void SetStream(std::ostream &inStream)
gdcm::StreamImageWriter::Write
bool Write(void *inWriteBuffer, const std::size_t &inBufferLength)
gdcm::StreamImageWriter::mZMax
uint16_t mZMax
Definition gdcmStreamImageWriter.h:113
gdcm::StreamImageWriter::WriteImageSubregionRAW
virtual bool WriteImageSubregionRAW(char *inWriteBuffer, const std::size_t &inBufferLength)
gdcm::StreamImageWriter::WriteImageInformation
virtual bool WriteImageInformation()
gdcm::StreamImageWriter::SetFileName
void SetFileName(const char *inFileName)
gdcm::StreamImageWriter::mYMax
uint16_t mYMax
Definition gdcmStreamImageWriter.h:113
gdcm::Writer
Writer ala DOM (Document Object Model).
Definition gdcmWriter.h:49
gdcmDataSet.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcmWriter.h
gdcm
Definition gdcmASN1.h:21