00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef SLICE_H
00010 #define SLICE_H
00011
00012
00013
00014 #include <QtGui>
00015 #include "Tool.h"
00016 #include "Section.h"
00017 #include "Volume.h"
00018
00019
00020
00021 namespace Iris { class IrisTests; }
00022
00023 class Slice : public VolumeIndex
00024 {
00025 friend void Volume::ChannelChanged( const QString & ch );
00026 friend void Volume::DownsampleChanged( const QString & ds );
00027 friend void Volume::AddSlice( Section *section, Slice *slice, int idx );
00028 friend void Volume::AddImage( Slice *slice, Image *image, int idx );
00029 friend void Volume::RefreshImages();
00030 friend void Volume::ClearImages( Slice *slice );
00031 friend void Volume::RefreshImages( Slice *slice );
00032 friend void Volume::DeleteImage( Image *image, bool trueDelete );
00033 friend void Volume::MoveImage( Slice *oldSlice, int oldRow, Slice *newSlice );
00034 friend class Section;
00035 friend class Iris::IrisTests;
00036
00037 public:
00038 Slice( const QString &name );
00039 ~Slice();
00040
00041 void Save( QXmlStreamWriter &xmlWriter );
00042
00043 QString Initialize( const QFileInfo &slice );
00044 QString InitializeFromXml( const QFileInfo &slice );
00045
00046 unsigned SliceNum() const;
00047 int NumImages() { VerifyImagesLoaded(); return images.count(); }
00048
00049 void SetSection( Section *section ) { this->section = section; }
00050
00051 static bool ReplaceSymbols( QString &str, const QString &channel, const VolumeIndex *slice = NULL, const VolumeIndex *nextSlice = NULL, const QString &save = "" );
00052 static bool InsertSymbols( QString &str, const VolumeIndex *slice = NULL, const VolumeIndex *nextSlice = NULL );
00053
00054 Slice& operator=(const Slice &rhs);
00055
00056 void RefreshRowCount();
00057
00058
00059 static QString GetChannel() { return currChannel_; }
00060 static QString GetDownsample() { return currDownsample_; }
00061 static QString GetSubDirs();
00062 static QString ParentName( const QFileInfo &fileInfo );
00063
00064 Section* GetSection() const { return this->section; }
00065 Image* GetImage( int row ) { VerifyImagesLoaded(); return this->images[row]; };
00066 int IndexOf( Image *image ) { return images.indexOf(image); }
00067 QList<Image *> GetImages() { return images; }
00068 void Dirty() { imagesDirty = true; }
00069 private:
00070 void VerifyImagesLoaded();
00071 bool imagesDirty;
00072
00073 Section *section;
00074
00075 QList<Image *> images;
00076
00077 static QString currChannel_;
00078 static QString currDownsample_;
00079 };
00080
00081 #endif