ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkJPEG2000ImageIO.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 #ifndef __itkJPEG2000ImageIO_h
00019 #define __itkJPEG2000ImageIO_h
00020 
00021 
00022 #include <fstream>
00023 #include "itkStreamingImageIOBase.h"
00024 #include "itkAutoPointer.h"
00025 
00026 namespace itk
00027 {
00028 
00029 class JPEG2000ImageIOInternal;
00030 
00049 class ITK_EXPORT JPEG2000ImageIO:public StreamingImageIOBase
00050 {
00051 public:
00053   typedef JPEG2000ImageIO      Self;
00054   typedef StreamingImageIOBase Superclass;
00055   typedef SmartPointer< Self > Pointer;
00056 
00058   itkNewMacro(Self);
00059 
00061   itkTypeMacro(JPEG2000ImageIO, StreamingImageIOBase);
00062 
00063   /*-------- This part of the interfaces deals with reading data. ----- */
00064 
00067   virtual bool CanReadFile(const char *);
00068 
00070   virtual void ReadImageInformation();
00071 
00073   virtual void Read(void *buffer);
00074 
00075   /*-------- This part of the interfaces deals with writing data. ----- */
00076 
00079   virtual bool CanWriteFile(const char *);
00080 
00082   virtual void WriteImageInformation();
00083 
00086   virtual void Write(const void *buffer);
00087 
00092   virtual ImageIORegion
00093   GenerateStreamableReadRegionFromRequestedRegion(const ImageIORegion & requested) const;
00094 
00096   virtual SizeType GetHeaderSize(void) const;
00097 
00099   void SetTileSize(int x, int y);
00100 
00106   virtual bool CanStreamWrite( void );
00107 
00108 protected:
00109   JPEG2000ImageIO();
00110   ~JPEG2000ImageIO();
00111 
00112   void PrintSelf(std::ostream & os, Indent indent) const;
00113 
00114 
00115 private:
00116   JPEG2000ImageIO(const Self &); //purposely not implemented
00117   void operator=(const Self &);  //purposely not implemented
00118 
00119   AutoPointer< JPEG2000ImageIOInternal >  m_Internal;
00120 
00121   typedef ImageIORegion::SizeValueType  SizeValueType;
00122   typedef ImageIORegion::IndexValueType IndexValueType;
00123 
00124   void ComputeRegionInTileBoundaries(unsigned int dimension,
00125                                      SizeValueType tileSize, ImageIORegion & streamableRegion) const;
00126 };
00127 } // end namespace itk
00128 
00129 #endif // __itkJPEG2000ImageIO_h
00130