11 for(
int item = 0; item < views; ++item ) {
12 m_pixmapItems.append(
new QGraphicsPixmapItem( ) );
13 m_labelItems.append(
new QGraphicsPixmapItem( ) );
15 m_currentImagePos = -1;
29 if( ( pos >= 0 ) && ( pos < m_images.size( ) ) ) {
30 return( m_images.at( pos ) );
36 return( m_currentImagePos );
40 qDebug( ) <<
"addimage.";
41 COMMENT(
"Loading file " << fname.toStdString( ), 0 );
46 catch( std::bad_alloc e ) {
49 catch( std::runtime_error e ) {
52 catch( std::out_of_range e ) {
55 catch( std::logic_error e ) {
60 if( img ==
nullptr ) {
64 m_images.append( img );
70 setRecentFile( fname );
102 return( m_images.isEmpty( ) );
106 COMMENT(
"Reseting images.", 1 );
107 qDeleteAll( m_images );
110 m_thumbsWidget->
clear( );
115 return( m_images.size( ) );
119 COMMENT(
"UPDATING IMAGE!", 2 );
124 for(
int axis = 0; axis < 4; ++axis ) {
125 if( showItens[ axis ] ) {
126 m_labelItems.at( axis )->setPixmap( QPixmap( ) );
127 const QPixmap &pix = img->
getSlice( axis );
128 m_pixmapItems.at( axis )->setPixmap( pix );
131 m_labelItems.at( axis )->setPixmap( tool->
getLabel( axis ) );
137 for(
int axis = 0; axis < m_pixmapItems.size( ); ++axis ) {
138 m_pixmapItems[ axis ]->setPixmap( QPixmap( ) );
145 m_currentImagePos = position;
171 scale = 1.0 + value / 100.0;
176 for(
int view = 0; view < m_pixmapItems.size( ); ++view ) {
178 m_pixmapItems[ view ]->setTransformationMode( Qt::SmoothTransformation );
181 m_pixmapItems[ view ]->setTransformationMode( Qt::FastTransformation );
206 void Controller::setRecentFile( QString fname ) {
207 COMMENT(
"Setting recent file to : \"" << fname.toStdString( ) <<
"\"", 1 );
208 if( !QFile( fname ).exists( ) ) {
212 QStringList files = settings.value(
"recentFileList" ).toStringList( );
214 files.removeAll( fname );
216 files.prepend( fname );
220 settings.setValue(
"recentFileList", files );
226 m_thumbsWidget = thumbsWidget;
233 return( rgb2dFormat );
236 return( bw3dFormat );
239 return( bw2dFormat );
244 return( m_pixmapItems.at( view ) );
248 return( m_labelItems.at( view ) );
void setCurrentImagePos(int position)
setCurrentImagePos
GuiImage * imageAt(int pos)
currentImage
Tool * currentTool()
currentTool returns the current Tool.
void recentFilesUpdated()
recentFilesUpdated
void rotateAll90()
rotateAll90 rotates all views in 90 degrees.
void update()
update updates the image pixmaps.
DisplayFormat * currentFormat()
currentFormat returns the modality of current image.
void flipH(size_t view)
flipH mirrors the current view on X axis.
The GuiImage class is a bridge to the Bial::Image data structure to the QImage data structure...
void setCurrentSlice(size_t view, size_t slice)
setCurrentSlice is called by the imageViewer when the slider or the spinbox have theis values updated...
void setInterpolation(bool isSmooth)
setInterpolation switches between smoot and fast interpolation.
void rotate90(size_t view)
rotate90 rotates a view in 90 degrees.
Controller(int views, QObject *parent=0)
Controller's constructor.
void flipH(size_t view)
flipH mirrors the current view on X axis.
Modality modality()
modality is the image modality getter.
bool removeCurrentLabel()
removeCurrentLabel removes the current label from current image.
void setZoom(int value)
setZoom updates the zoom factor.
void removeCurrentImage()
removeCurrentImage removes the current image from vector.
void flipV(size_t view)
flipV mirrors the current view on Y axis.
QPixmap getSlice(size_t view)
getSlice calculates and returns a QImage with the current slice of the view.
void setCurrentSlice(size_t view, size_t slice)
currentSlice sets the view's current slice.
void rotateAll90()
rotateAll90 rotates all views in 90 degrees.
void flipV(size_t view)
flipV mirrors the current view on Y axis.
void loadNextImage()
loadNextImage is a slot called from controlsdock that loads the next image ( like an circular list )...
void imageUpdated()
imageUpdated is called each time a internal property is updated, after that the image views are updat...
void clear()
clear Clears the image vector, and resets thumbnails.
QGraphicsPixmapItem * getLabelItem(size_t view)
getLabelItem returns the LabelItem of the view.
QGraphicsPixmapItem * getPixmapItem(size_t view)
getPixmapItem returns the PixmapItem of the view.
GuiImage * currentImage()
currentImage
int currentImagePos() const
currentImagePos
void currentImageChanged()
This signal is emmited every time the current image changes.
void rotate90(size_t view)
rotate90 rotates a view in 90 degrees.
bool addLabel(QString label)
addLabel Adds a label to the current image.
void setThumbsWidget(ThumbsWidget *thumbsWidget)
setThumbsWidget setThumbsWidget sets the pointer to the thumbnails dock.
#define BIAL_WARNING(exp)
Use BIAL_WARNING to print a message to the output stream warn the user that something bad may have ha...
void containerUpdated()
This signal is emmited avery time the m_images vector is updated.
void imageUpdated()
This signal is emmited every time the current image is updated.
bool addImage(QString fname)
addImage Adds an image to vector m_images.