//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+void vvImage::InitializeTransform()
+{
+ for (int i = 0; i < mTransform.size(); i++)
+ mTransform[i]->Identity();
+}
+//--------------------------------------------------------------------
+
+
//--------------------------------------------------------------------
std::vector< std::vector<double> > vvImage::GetDirection()
{
bool IsScalarTypeInteger();
bool IsScalarTypeInteger(int t);
const std::vector< vtkSmartPointer<vtkTransform> >& GetTransform();
+ void InitializeTransform();
void SetTimeSpacing(double s) { mTimeSpacing = s; }
void SetTimeOrigin(double o) { mTimeOrigin = o; }
bool HaveSameSizeAndSpacingThan(vvImage * other);
mLastError = "";
mType = UNDEFINEDIMAGETYPE;
mSlice = 0;
+ mPatientCoordinateSystem = false;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void vvImageReader::SetPatientCoordinateSystem(bool patientCoordinateSystem)
+{
+ mPatientCoordinateSystem = patientCoordinateSystem;
+}
+//------------------------------------------------------------------------------
+
+
//------------------------------------------------------------------------------
void vvImageReader::Update(LoadedImageType type)
{
}
void SetSlice(unsigned int i) { mSlice = i; }
+ void SetPatientCoordinateSystem(bool patientCoordinateSystem);
//====================================================================
// Main function
void UpdateWithDimAndInputVectorPixelType();
///Input dimension and pixel type
int mDim;
+ bool mPatientCoordinateSystem;
std::string mInputPixelType;
//====================================================================
}
}
}
+
+ if (mType == DICOM && !mPatientCoordinateSystem)
+ mImage->InitializeTransform();
}
//----------------------------------------------------------------------------
<number>0</number>
</property>
<item>
- <widget class="QLabel" name="mLabelSelected_3" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string><b>Files in current DICOM serie</b></string>
- </property>
- <property name="textFormat" >
- <enum>Qt::RichText</enum>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout_3" >
+ <item>
+ <widget class="QLabel" name="mLabelSelected_3" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string><b>Files in current DICOM serie</b></string>
+ </property>
+ <property name="textFormat" >
+ <enum>Qt::RichText</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="mIsMatrixCheckBox" >
+ <property name="text" >
+ <string>Patient coordinate system</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<widget class="QListWidget" name="mDicomDetailsListWidget" >
// Change filename if an image with the same already exist
int number = GetImageDuplicateFilenameNumber(files[i] + std::string("_slice"));
- if (filetype == vvImageReader::IMAGE || filetype == vvImageReader::IMAGEWITHTIME || filetype == vvImageReader::SLICED) {
+ if (filetype == vvImageReader::IMAGE || filetype == vvImageReader::IMAGEWITHTIME || filetype == vvImageReader::SLICED)
SetImageSucceed = imageManager->SetImage(files[i],filetype, number, j);
- } else {
+ else if (filetype == vvImageReader::DICOM)
+ SetImageSucceed = imageManager->SetImages(files,filetype, number, dicomSeriesSelector->IsPatientCoordianteSystemChecked());
+ else
SetImageSucceed = imageManager->SetImages(files,filetype, number);
- }
+
if (!SetImageSucceed) {
QApplication::restoreOverrideCursor();
QString error = "Cannot open file \n";
this, SLOT(itemSelectionChanged()));
connect(ui.mDicomDetailsListWidget, SIGNAL(itemSelectionChanged()),
this, SLOT(itemDetailsSelectionChanged()));
+ connect(ui.mIsMatrixCheckBox, SIGNAL(stateChanged(int)),
+ this, SLOT(itemMatrixSelectionChanged(int)));
// Initialization
/* if (config::get_current_path() != QString(0))
mPreviousPath = mFoldername;
ui.mFolderLineEdit->setText(mFoldername);
+ ui.mIsMatrixCheckBox->setChecked(0);
+ mPatientCoordinateSystem = false;
// ui.mTableWidget->setRowCount(0);
}
//====================================================================
}
//====================================================================
+
+//====================================================================
+void vvDicomSeriesSelector::itemMatrixSelectionChanged(int state)
+{
+ mPatientCoordinateSystem = state;
+}
+//====================================================================
+
+
#endif // VVDICOMSERIESSELECTOR_CXX
std::vector<std::string> * GetFilenames() {
return mFilenames;
}
+ bool IsPatientCoordianteSystemChecked() { return mPatientCoordinateSystem; }
protected slots:
void BrowseButtonRelease();
void SearchButtonRelease();
void itemSelectionChanged();
void itemDetailsSelectionChanged();
+ void itemMatrixSelectionChanged(int state);
protected:
QString mPreviousPath;
std::map<std::string, gdcm::File*> mDicomHeader;
#endif
std::map<std::string, std::string> mDicomDetails;
+ bool mPatientCoordinateSystem;
};
#endif // VVDICOMSERIESSELECTOR_H
//----------------------------------------------------------------------------
-bool vvSlicerManager::SetImages(std::vector<std::string> filenames, vvImageReader::LoadedImageType type, int n)
+bool vvSlicerManager::SetImages(std::vector<std::string> filenames, vvImageReader::LoadedImageType type, int n, bool patientCoordinateSystem)
{
mType = type;
std::string fileWithoutExtension = vtksys::SystemTools::GetFilenameWithoutExtension(filenames[0]);
if (mReader.IsNull())
mReader = vvImageReader::New();
mReader->SetInputFilenames(filenames);
+ if (type == vvImageReader::DICOM)
+ mReader->SetPatientCoordinateSystem(patientCoordinateSystem);
mReader->Update(type);
mBaseFileName = vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(mFileName));
bool SetImage(std::string filename, vvImageReader::LoadedImageType type, int n=0, unsigned int slice=0);
void SetImage(vvImage::Pointer image);
- bool SetImages(std::vector<std::string> filenames, vvImageReader::LoadedImageType type, int n=0);
+ bool SetImages(std::vector<std::string> filenames, vvImageReader::LoadedImageType type, int n=0, bool patientCoordinateSystem=0);
bool SetOverlay(std::vector<std::string> filenames, int dim, std::string component, vvImageReader::LoadedImageType type);
bool SetFusion(std::vector<std::string> filenames,int dim, std::string component, vvImageReader::LoadedImageType type);