Isis 3 Programmer Reference
QtImporter.cpp
1
6/* SPDX-License-Identifier: CC0-1.0 */
7#include "QtImporter.h"
8
9#include <QImage>
10
11#include "FileName.h"
12#include "IException.h"
13#include "IString.h"
14
15using namespace Isis;
16
17
18namespace Isis {
25 m_qimage = NULL;
26
27 m_qimage = new QImage(inputName.expanded());
28 if (m_qimage->isNull()) {
30 "The file [" + inputName.expanded() +
31 "] does not contain a recognized image format",
32 _FILEINFO_);
33 }
34
35 setSamples(m_qimage->width());
36 setLines(m_qimage->height());
38 }
39
40
45 delete m_qimage;
46 m_qimage = NULL;
47 }
48
49
56 return m_qimage->isGrayscale();
57 }
58
59
66 bool QtImporter::isRgb() const {
67 return !isGrayscale() && !isArgb();
68 }
69
70
76 bool QtImporter::isArgb() const {
77 return m_qimage->hasAlphaChannel();
78 }
79
80
88 void QtImporter::updateRawBuffer(int line, int band) const {
89 }
90
91
102 int QtImporter::getPixel(int s, int l) const {
103 return m_qimage->pixel(s, l);
104 }
105
106
114 int QtImporter::getGray(int pixel) const {
115 return qGray(pixel);
116 }
117
118
126 int QtImporter::getRed(int pixel) const {
127 return qRed(pixel);
128 }
129
130
138 int QtImporter::getGreen(int pixel) const {
139 return qGreen(pixel);
140 }
141
142
150 int QtImporter::getBlue(int pixel) const {
151 return qBlue(pixel);
152 }
153
154
162 int QtImporter::getAlpha(int pixel) const {
163 return qAlpha(pixel);
164 }
165};
166
File name manipulation and expansion.
Definition FileName.h:100
Isis exception class.
Definition IException.h:91
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition IException.h:126
Imports images with standard formats into Isis as cubes.
void setLines(int l)
Set the line dimension (height) of the output image.
void setSamples(int s)
Set the sample dimension (width) of the output image.
void setDefaultBands()
Set the number of bands to be created for the output cube based on the number of color channels in th...
virtual bool isGrayscale() const
Tests to see if the input image is grayscale (no RGB/A).
virtual void updateRawBuffer(int line, int band) const
Does nothing as Qt reads the entire input image into memory, and therefore does not need to be update...
virtual bool isRgb() const
Tests to see if the input image is neither grayscale nor has an alpha channel, implying RGB (no alpha...
virtual bool isArgb() const
Tests to see if the input image is has an alpha channel, implying RGBA.
virtual ~QtImporter()
Destruct the importer.
QImage * m_qimage
Structure holding all input image data in memory.
Definition QtImporter.h:60
virtual int getAlpha(int pixel) const
Retrieves the alpha component of the given pixel.
virtual int getRed(int pixel) const
Retrieves the red component of the given pixel.
QtImporter(FileName inputName)
Construct the importer.
virtual int getGreen(int pixel) const
Retrieves the green component of the given pixel.
virtual int getPixel(int s, int l) const
Returns a representation of a pixel for the input format that can then be broken down into specific g...
virtual int getGray(int pixel) const
Retrieves the gray component of the given pixel.
virtual int getBlue(int pixel) const
Retrieves the blue component of the given pixel.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16