3030
3131#include < boost/lexical_cast.hpp>
3232
33+ #include " FilePool/FileManager.h"
3334#include " SEFramework/CoordinateSystem/CoordinateSystem.h"
3435#include " SEFramework/Image/ImageSourceWithMetadata.h"
35- #include " SEFramework/FITS/FitsFileManager.h"
3636#include " SEFramework/FITS/FitsFile.h"
3737#include " SEUtils/VariantCast.h"
3838
3939
4040namespace SourceXtractor {
4141
42- class FitsImageSource : public ImageSource , public std ::enable_shared_from_this<ImageSource> {
42+ using Euclid::FilePool::FileManager;
43+ using Euclid::FilePool::FileHandler;
44+
45+ class FitsImageSource : public ImageSource , public std ::enable_shared_from_this<ImageSource> {
4346public:
4447
4548
@@ -51,12 +54,16 @@ class FitsImageSource : public ImageSource, public std::enable_shared_from_this<
5154 * HDU number. If <= 0, the constructor will use the first HDU containing an image
5255 * @param manager
5356 */
54- FitsImageSource (const std::string &filename, int hdu_number = 0 , ImageTile::ImageType image_type = ImageTile::AutoType,
55- std::shared_ptr<FitsFileManager> manager = FitsFileManager::getInstance());
57+ FitsImageSource (const std::string& filename, int hdu_number = 0 ,
58+ ImageTile::ImageType image_type = ImageTile::AutoType,
59+ std::shared_ptr<FileManager> manager = FileManager::getDefault());
5660
57- FitsImageSource (const std::string &filename, int width, int height, ImageTile::ImageType image_type,
58- const std::shared_ptr<CoordinateSystem> coord_system = nullptr , bool append=false ,
59- bool empty_primary=false , std::shared_ptr<FitsFileManager> manager = FitsFileManager::getInstance());
61+ FitsImageSource (const std::string& filename, int width, int height,
62+ ImageTile::ImageType image_type,
63+ const std::shared_ptr<CoordinateSystem> coord_system = nullptr ,
64+ bool append = false ,
65+ bool empty_primary = false ,
66+ std::shared_ptr<FileManager> manager = FileManager::getDefault());
6067
6168 virtual ~FitsImageSource () = default ;
6269
@@ -70,15 +77,15 @@ class FitsImageSource : public ImageSource, public std::enable_shared_from_this<
7077 }
7178
7279 // / Returns the height of the image in pixels
73- int getHeight () const override {
80+ int getHeight () const override {
7481 return m_height;
7582 }
7683
7784 std::shared_ptr<ImageTile> getImageTile (int x, int y, int width, int height) const override ;
7885
7986 void saveTile (ImageTile& tile) override ;
8087
81- template <typename TT>
88+ template <typename TT>
8289 bool readFitsKeyword (const std::string& header_keyword, TT& out_value) const {
8390 auto & headers = getMetadata ();
8491 auto i = headers.find (header_keyword);
@@ -99,21 +106,19 @@ class FitsImageSource : public ImageSource, public std::enable_shared_from_this<
99106
100107 std::unique_ptr<std::vector<char >> getFitsHeaders (int & number_of_records) const ;
101108
102- const std::map<std::string, MetadataEntry> getMetadata () const override {
103- return m_fits_file->getHDUHeaders (m_hdu_number);
104- }
109+ const std::map<std::string, MetadataEntry> getMetadata () const override ;
105110
106111 void setMetadata (std::string key, MetadataEntry value) override ;
107112
108113private:
109- void switchHdu (fitsfile* fptr, int hdu_number) const ;
114+ void switchHdu (fitsfile * fptr, int hdu_number) const ;
110115
111116 int getDataType () const ;
117+
112118 int getImageType () const ;
113119
114120 std::string m_filename;
115- std::shared_ptr<FitsFile> m_fits_file;
116- std::shared_ptr<FitsFileManager> m_manager;
121+ std::shared_ptr<FileHandler> m_handler;
117122
118123 int m_hdu_number;
119124
0 commit comments