00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date: 2008-08-27 17:18:46 +0200 (Mi, 27 Aug 2008) $ 00006 Version: $Revision: 15096 $ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef _MITK_NRRDQBI_WRITER__H_ 00019 #define _MITK_NRRDQBI_WRITER__H_ 00020 00021 #include <itkProcessObject.h> 00022 #include <mitkFileWriterWithInformation.h> 00023 #include <mitkQBallImage.h> 00024 00025 00026 namespace mitk 00027 { 00028 00033 class NrrdQBallImageWriter : public mitk::FileWriterWithInformation 00034 { 00035 public: 00036 00037 mitkClassMacro( NrrdQBallImageWriter, mitk::FileWriterWithInformation ); 00038 00039 mitkWriterMacro; 00040 00041 itkNewMacro( Self ); 00042 00043 typedef mitk::QBallImage InputType; 00044 00049 itkSetStringMacro( FileName ); 00050 00054 itkGetStringMacro( FileName ); 00055 00059 itkSetStringMacro( FilePrefix ); 00060 00064 itkGetStringMacro( FilePrefix ); 00065 00069 itkSetStringMacro( FilePattern ); 00070 00074 itkGetStringMacro( FilePattern ); 00075 00080 void SetInput( InputType* input ); 00081 00085 InputType* GetInput(); 00086 00090 itkGetMacro( Success, bool ); 00091 00095 virtual std::vector<std::string> GetPossibleFileExtensions(); 00096 00097 // FileWriterWithInformation methods 00098 virtual const char * GetDefaultFilename() { return "QBalls.qbi"; } 00099 virtual const char * GetFileDialogPattern() { return "Q-Ball Images (*.qbi *.hqbi"; } 00100 virtual const char * GetDefaultExtension() { return ".qbi"; } 00101 virtual bool CanWriteDataType(BaseData::Pointer data) { return (dynamic_cast<mitk::QBallImage*>(data.GetPointer()) != NULL); }; 00102 virtual void DoWrite(BaseData::Pointer data) { 00103 if (CanWriteDataType(data)) { 00104 this->SetInput(dynamic_cast<mitk::QBallImage*>(data.GetPointer())); 00105 this->Update(); 00106 } 00107 }; 00108 00109 protected: 00110 00111 NrrdQBallImageWriter(); 00112 00113 virtual ~NrrdQBallImageWriter(); 00114 00115 virtual void GenerateData(); 00116 00117 std::string m_FileName; 00118 00119 std::string m_FilePrefix; 00120 00121 std::string m_FilePattern; 00122 00123 bool m_Success; 00124 00125 }; 00126 00127 00128 } // end of namespace mitk 00129 00130 #endif //_MITK_NRRDQBI_WRITER__H_