GDCM 2.2.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

gdcmStreamImageWriter.h
Go to the documentation of this file.

    00001 /*=========================================================================
    00002  *
    00003  *  Copyright Insight Software Consortium
    00004  *
    00005  *  Licensed under the Apache License, Version 2.0 (the "License");
    00006  *  you may not use this file except in compliance with the License.
    00007  *  You may obtain a copy of the License at
    00008  *
    00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
    00010  *
    00011  *  Unless required by applicable law or agreed to in writing, software
    00012  *  distributed under the License is distributed on an "AS IS" BASIS,
    00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00014  *  See the License for the specific language governing permissions and
    00015  *  limitations under the License.
    00016  *
    00017  *=========================================================================*/
    00018
    00019 #ifndef GDCMSTREAMIMAGEWRITER_H
    00020 #define GDCMSTREAMIMAGEWRITER_H
    00021
    00022 #include "gdcmWriter.h"
    00023 #include <iostream>
    00024 #include "gdcmDataSet.h"
    00025
    00026 namespace gdcm
    00027 {
    00028
    00029 class MediaStorage;
    00030 class RAWCodec;
    00042 class GDCM_EXPORT StreamImageWriter
    00043 {
    00044
    00045 public:
    00046   StreamImageWriter();
    00047   ~StreamImageWriter();
    00048
    00049
    00053   void SetFileName(const char* inFileName);
    00054   void SetStream(std::ostream& inStream);
    00055
    00064   void DefinePixelExtent(uint16_t inXMin, uint16_t inXMax,
    00065     uint16_t inYMin, uint16_t inYMax, uint16_t inZMin = 0, uint16_t inZMax = 1);
    00066
    00067
    00073   uint32_t DefineProperBufferLength();
    00074
    00082   bool Write(void* inWriteBuffer, const std::size_t& inBufferLength);
    00083
    00087   virtual bool WriteImageInformation();
    00088
    00092   bool CanWriteFile() const;
    00093
    00094
    00097   void SetFile(const File& inFile);
    00098
    00099 protected:
    00100
    00101   //contains the PrepareWrite function, which will get the given dataset ready
    00102   //for writing to disk by manufacturing the header information.
    00103   //note that if there is a pixel element in the given dataset, that will be removed
    00104   //during the copy, so that the imagewriter can write everything else out
    00105   Writer mWriter;
    00106
    00107   //is the offset necessary if we always append?
    00108   //std::streamoff mFileOffset; //the fileoffset for getting header information
    00109   SmartPointer<File> mspFile; //all the non-pixel information
    00110
    00111   //for thread safety, these should not be stored here, but should be used
    00112   //for every read subregion operation.
    00113   uint16_t mXMin, mYMin, mXMax, mYMax, mZMin, mZMax;
    00114
    00119   //virtual bool ReadImageSubregionRAW(std::ostream& os);
    00120   virtual bool WriteImageSubregionRAW(char* inWriteBuffer, const std::size_t& inBufferLength);
    00121
    00131   int WriteRawHeader(RAWCodec* inCodec, std::ostream* inStream);
    00132
    00137   int mElementOffsets;
    00138   int mElementOffsets1;
    00139
    00140 };
    00141
    00142
    00143 } // end namespace gdcm
    00144
    00145 #endif //GDCMSTREAMIMAGEWRITER_H