Code clean and code style error fix.

This commit is contained in:
Krad
2022-04-19 15:40:58 +08:00
parent cba0b17c50
commit 30cdabdc74
8 changed files with 52 additions and 63 deletions

View File

@@ -88,18 +88,18 @@ void DICOMDirectoryHelper::getFileProperty(const std::string &path, DICOMFileMap
dataset->findAndGetOFString(DcmTagKey(group, element), Name);\ dataset->findAndGetOFString(DcmTagKey(group, element), Name);\
seriesProperty->Set##Name(Name.c_str()); seriesProperty->Set##Name(Name.c_str());
ReadTAGToProperty(PatientID, 0x0010, 0x0020); ReadTAGToProperty(PatientID, 0x0010, 0x0020)
ReadTAGToProperty(PatientName, 0x0010, 0x0010); ReadTAGToProperty(PatientName, 0x0010, 0x0010)
ReadTAGToProperty(PatientBirthDate, 0x0010, 0x0030); ReadTAGToProperty(PatientBirthDate, 0x0010, 0x0030)
ReadTAGToProperty(PatientSex, 0x0010, 0x0040); ReadTAGToProperty(PatientSex, 0x0010, 0x0040)
ReadTAGToProperty(StudyDate, 0x0008, 0x0020); ReadTAGToProperty(StudyDate, 0x0008, 0x0020)
ReadTAGToProperty(StudyTime, 0x0008, 0x0030); ReadTAGToProperty(StudyTime, 0x0008, 0x0030)
ReadTAGToProperty(Modality, 0x0008, 0x0060); ReadTAGToProperty(Modality, 0x0008, 0x0060)
ReadTAGToProperty(InstitutionName, 0x0008, 0x0080); ReadTAGToProperty(InstitutionName, 0x0008, 0x0080)
ReadTAGToProperty(StudyDescription, 0x0008, 0x1030); ReadTAGToProperty(StudyDescription, 0x0008, 0x1030)
ReadTAGToProperty(SeriesDescription, 0x0008, 0x103E); ReadTAGToProperty(SeriesDescription, 0x0008, 0x103E)
ReadTAGToProperty(StudyUID, 0x0020, 0x000d); ReadTAGToProperty(StudyUID, 0x0020, 0x000d)
ReadTAGToProperty(StudyID, 0x0020, 0x0010); ReadTAGToProperty(StudyID, 0x0020, 0x0010)
seriesProperty->SetSeriesUID(SeriesUID.c_str()); seriesProperty->SetSeriesUID(SeriesUID.c_str());
seriesProperty->SetSeriesNumber(SeriesNumber); seriesProperty->SetSeriesNumber(SeriesNumber);
std::string uniqueID; std::string uniqueID;
@@ -148,7 +148,7 @@ void DICOMDirectoryHelper::getFileProperty(const std::string &path, DICOMFileMap
char buffer[256] = {0}; char buffer[256] = {0};
sprintf(buffer, "%ld-%ld", AcquisitionNumber, InstanceNumber); sprintf(buffer, "%ld-%ld", AcquisitionNumber, InstanceNumber);
printf("%s\r\n", path.c_str()); printf("%s\r\n", path.c_str());
result[SeriesUID][buffer] = {std::move(path), SeriesNumber, AcquisitionNumber, InstanceNumber}; result[SeriesUID][buffer] = {path, SeriesNumber, AcquisitionNumber, InstanceNumber};
} }
} }
@@ -159,7 +159,7 @@ void DICOMDirectoryHelper::Update() {
getDirectoryProperties(this->dirName.c_str(), series); getDirectoryProperties(this->dirName.c_str(), series);
} }
else{ else{
getFileProperty(this->fileName.c_str(), series); getFileProperty(fileName, series);
} }
//sort files //sort files
for (auto &pair : series) { for (auto &pair : series) {

View File

@@ -1,7 +1,5 @@
#include "base/DicomLoader.h" #include "base/DicomLoader.h"
#include <QObject>
#include <QMainWindow>
#include <QStatusBar>
#include "base/SeriesImageSet.h" #include "base/SeriesImageSet.h"
#include "DICOMDirectoryHelper.h" #include "DICOMDirectoryHelper.h"
#include "ExtendMedicalImageProperties.h" #include "ExtendMedicalImageProperties.h"
@@ -214,9 +212,9 @@ void DicomLoader::readSeries() {
else { else {
study->series->insert({series_uid,property}); study->series->insert({series_uid,property});
double *wlww = property->GetNthWindowLevelPreset(0); // double *wlww = property->GetNthWindowLevelPreset(0);
int ww = wlww ? ((int) wlww[0]) : (512); // int ww = wlww ? ((int) wlww[0]) : (512);
int wl = wlww ? ((int) wlww[1]) : (256); // int wl = wlww ? ((int) wlww[1]) : (256);
} }
} }

View File

@@ -1,6 +1,6 @@
#include "base/SeriesImageSet.h" #include "base/SeriesImageSet.h"
#include <vtkRendererCollection.h> #include <vtkRendererCollection.h>
#include "view/DicomImageView.h" #include "view/dicomimageview.h"
#include "base/DicomLoader.h" #include "base/DicomLoader.h"
#include <QPainter> #include <QPainter>
#include <QDebug> #include <QDebug>
@@ -26,11 +26,6 @@ SeriesImageSet::~SeriesImageSet() {
} }
void SeriesImageSet::setUpSeriesInstance()
{
}
const char* SeriesImageSet::getCurImageName() const const char* SeriesImageSet::getCurImageName() const
{ {

View File

@@ -1,4 +1,4 @@
#pragma once #pragma once
#include "global/include_vitk.h" #include "global/include_vitk.h"
#include <memory> #include <memory>
@@ -11,13 +11,10 @@ class SeriesImageSet : public QObject
public: public:
SeriesImageSet::SeriesImageSet(ExtendMedicalImageProperties* property, vtkImageData* imagedata); SeriesImageSet(ExtendMedicalImageProperties* property, vtkImageData* imagedata);
~SeriesImageSet() override; ~SeriesImageSet() override;
//UniqueID
void setUpSeriesInstance();
//UniqueID
std::string const & getUniqueID() { std::string const & getUniqueID() {
return m_pUniqueID; return m_pUniqueID;
}; };
@@ -32,18 +29,13 @@ public:
m_image->Print(std::cout); m_image->Print(std::cout);
return m_image; return m_image;
}; };
//image data //Image Properties
ExtendMedicalImageProperties* GetProperty() ExtendMedicalImageProperties* GetProperty()
{ {
return m_property; return m_property;
}; };
//camera config void getCameraCfg(double *vup, double *camPos)
double GetExtent()
{
return m_extent;
}
void getCameraCfg(double *vup, double *camPos)
{ {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {

View File

@@ -21,7 +21,6 @@
#include "measure/MeasureStore.h" #include "measure/MeasureStore.h"
#include "vtkTextActor.h" #include "vtkTextActor.h"
#include "vtkTextProperty.h" #include "vtkTextProperty.h"
#include "ExtendMedicalImageProperties.h"
#include "util/ColorMapReader.h" #include "util/ColorMapReader.h"
#include "vtkMath.h" #include "vtkMath.h"
#include "vtkImageStack.h" #include "vtkImageStack.h"
@@ -98,7 +97,7 @@ void infinitiViewer::SetFusionInputData(vtkImageData* data)
bar->SetLabelFormat("%.0f"); bar->SetLabelFormat("%.0f");
bar->UnconstrainedFontSizeOff(); bar->UnconstrainedFontSizeOff();
bar->SetUnconstrainedFontSize(16); bar->SetUnconstrainedFontSize(true);
bar->SetLabelTextProperty(LabelTextProperty); bar->SetLabelTextProperty(LabelTextProperty);
this->Renderer->AddActor(bar); this->Renderer->AddActor(bar);
@@ -335,6 +334,9 @@ infinitiViewer::infinitiViewer()
cornerAnnotation->SetNonlinearFontScaleFactor(1); cornerAnnotation->SetNonlinearFontScaleFactor(1);
cornerAnnotation->SetMaximumFontSize(FontSizeHelper::font_size); cornerAnnotation->SetMaximumFontSize(FontSizeHelper::font_size);
OpacityActor = nullptr;
bar = nullptr;
loadedMeasureSlice = 0;
this->Slice = 0; this->Slice = 0;
@@ -346,15 +348,15 @@ infinitiViewer::infinitiViewer()
// Setup the pipeline // Setup the pipeline
vtkRenderWindow* renwin = vtkRenderWindow::New(); vtkRenderWindow* renwin = vtkRenderWindow::New();
this->SetRenderWindow(renwin); infinitiViewer::SetRenderWindow(renwin);
renwin->Delete(); renwin->Delete();
vtkRenderer* ren = vtkRenderer::New(); vtkRenderer* ren = vtkRenderer::New();
this->SetRenderer(ren); infinitiViewer::SetRenderer(ren);
ren->Delete(); ren->Delete();
this->InstallPipeline(); infinitiViewer::InstallPipeline();
this->AddObserver(infinitiViewerEvents::SlicedEvent, this, &infinitiViewer::LoadMeasures); this->AddObserver(infinitiViewerEvents::SlicedEvent, this, &infinitiViewer::LoadMeasures);
this->AddObserver(infinitiViewerEvents::SlicedEvent, this, &infinitiViewer::updateTopLeftCornerInfo); this->AddObserver(infinitiViewerEvents::SlicedEvent, this, &infinitiViewer::updateTopLeftCornerInfo);
@@ -1207,10 +1209,10 @@ void infinitiViewer::UpdateOrientation()
void infinitiViewer::updateTopLeftCornerInfo() void infinitiViewer::updateTopLeftCornerInfo()
{ {
if (AnnoHelper::IsAnno()) { if (AnnoHelper::IsAnno()) {
int _MaxSlice = this->GetSliceMax(); int maxSlice = this->GetSliceMax();
int _Slice = this->GetSlice(); int currentSlice = this->GetSlice();
std::string msg_const = m_cornerInfo.ConstAnno[TOP_LEFT]; std::string msg_const = m_cornerInfo.ConstAnno[TOP_LEFT];
std::string msg_var = StatusMessage::Format(_Slice, _MaxSlice); std::string msg_var = StatusMessage::Format(maxSlice, currentSlice);
std::string msg_upleft = StatusMessage::Format(msg_var, msg_const); std::string msg_upleft = StatusMessage::Format(msg_var, msg_const);
cornerAnnotation->SetText(TOP_LEFT, msg_upleft.c_str()); cornerAnnotation->SetText(TOP_LEFT, msg_upleft.c_str());
} }
@@ -1223,11 +1225,11 @@ void infinitiViewer::updateCornerInfo(int index)
if (index == TOP_LEFT) if (index == TOP_LEFT)
{ {
int _MaxSlice = this->GetSliceMax(); int maxSlice = this->GetSliceMax();
int _Slice = this->GetSlice(); int currentSlice = this->GetSlice();
//cout << "MoveSliceForward::Slice = " << _Slice << std::endl; //cout << "MoveSliceForward::Slice = " << _Slice << std::endl;
std::string msg_const = m_cornerInfo.ConstAnno[index]; std::string msg_const = m_cornerInfo.ConstAnno[index];
std::string msg_var = StatusMessage::Format(_Slice, _MaxSlice); std::string msg_var = StatusMessage::Format(currentSlice, maxSlice);
std::string msg_upleft = StatusMessage::Format(msg_var, msg_const); std::string msg_upleft = StatusMessage::Format(msg_var, msg_const);
//_StatusMapper->SetInput(msg.c_str()); //_StatusMapper->SetInput(msg.c_str());
cornerAnnotation->SetText(index, msg_upleft.c_str()); cornerAnnotation->SetText(index, msg_upleft.c_str());
@@ -1360,7 +1362,6 @@ void infinitiViewer::updateOrienInfo()
static const char* dds[6] ={"R","L","A","P","F","H"}; static const char* dds[6] ={"R","L","A","P","F","H"};
double proj[4] ={0,0,0,1}; double proj[4] ={0,0,0,1};
Renderer->GetActiveCamera()->GetDirectionOfProjection(proj); Renderer->GetActiveCamera()->GetDirectionOfProjection(proj);
double invertProj[4] ={-proj[0],-proj[1],-proj[2],1};
double viewUp[4]= {0,0,0,1}; double viewUp[4]= {0,0,0,1};
this->Renderer->GetActiveCamera()->GetViewUp(viewUp); this->Renderer->GetActiveCamera()->GetViewUp(viewUp);
double viewRight[4] = {0, 0, 0, 1}; double viewRight[4] = {0, 0, 0, 1};
@@ -1369,13 +1370,17 @@ void infinitiViewer::updateOrienInfo()
double viewUpVector[4]= {0,0,0,1}; double viewUpVector[4]= {0,0,0,1};
double viewRightVector[4]= {0,0,0,1}; double viewRightVector[4]= {0,0,0,1};
//top and bottom
matrix->MultiplyPoint(viewUp, viewUpVector); matrix->MultiplyPoint(viewUp, viewUpVector);
int flag = getOrientationIndex(viewUpVector); int flag = getOrientationIndex(viewUpVector);
viewUpIndex = flag;
cornerAnnotation->SetText(TOP_MIDDLE, dds[flag]); cornerAnnotation->SetText(TOP_MIDDLE, dds[flag]);
cornerAnnotation->SetText(BOTTOM_MIDDLE, dds[getOppositeOrientation(flag)]); cornerAnnotation->SetText(BOTTOM_MIDDLE, dds[getOppositeOrientation(flag)]);
//left and right
matrix->MultiplyPoint(viewRight, viewRightVector); matrix->MultiplyPoint(viewRight, viewRightVector);
flag = getOrientationIndex(viewRightVector); flag = getOrientationIndex(viewRightVector);
viewRightIndex = flag;
cornerAnnotation->SetText(RIGHT_MIDDLE, dds[flag]); cornerAnnotation->SetText(RIGHT_MIDDLE, dds[flag]);
cornerAnnotation->SetText(LEFT_MIDDLE, dds[getOppositeOrientation(flag)]); cornerAnnotation->SetText(LEFT_MIDDLE, dds[getOppositeOrientation(flag)]);
cornerAnnotation->Modified(); cornerAnnotation->Modified();

View File

@@ -73,7 +73,7 @@ public:
/** /**
* Render the resulting image. * Render the resulting image.
*/ */
virtual void Render(void); virtual void Render();
//@{ //@{
/** /**
@@ -326,9 +326,10 @@ protected:
infinitiViewer(); infinitiViewer();
~infinitiViewer() override; ~infinitiViewer() override;
virtual void InstallPipeline(); virtual void InstallPipeline();
virtual void UnInstallPipeline(); virtual void UnInstallPipeline();
virtual void PrepareFusionColorTable(vtkScalarsToColors* table, bool reset = false);
void PrepareFusionColorTable(vtkScalarsToColors* table, bool reset = false);
vtkRenderWindow* RenderWindow; vtkRenderWindow* RenderWindow;
vtkRenderer* Renderer; vtkRenderer* Renderer;
@@ -394,7 +395,7 @@ private:
int currentPresetIndex=1; int currentPresetIndex=1;
DicomCornerInfo m_cornerInfo; DicomCornerInfo m_cornerInfo;
char SOP_UID[20]; char SOP_UID[20]={0};
vtkNew<vtkMatrix4x4> matrix; vtkNew<vtkMatrix4x4> matrix;
}; };

View File

@@ -35,7 +35,6 @@ public:
static DraggableActor *New(); static DraggableActor *New();
vtkTypeMacro(DraggableActor, vtkProp); vtkTypeMacro(DraggableActor, vtkProp);
// void PrintSelf(ostream& os, vtkIndent indent) override;
//@} //@}
enum DraggableActorEvents { enum DraggableActorEvents {

View File

@@ -1,7 +1,6 @@
#include "view/dicomimageview.h" #include "view/dicomimageview.h"
#include <QMessageBox> #include <QMessageBox>
#include <QDebug> #include <QDebug>
#include <QMimeData>
#include "view/thumbnailImage.h" #include "view/thumbnailImage.h"
#include <vtkInteractorStyleImage.h> #include <vtkInteractorStyleImage.h>
#include "vtkImageProperty.h" #include "vtkImageProperty.h"
@@ -261,7 +260,7 @@ void DicomImageView::resizeEvent(QResizeEvent *event)
int ax = (this->geometry().bottomLeft().x() + this->geometry().bottomRight().x()) / 2 + int ax = (this->geometry().bottomLeft().x() + this->geometry().bottomRight().x()) / 2 +
VCRHelper::getVCRXOffset(); VCRHelper::getVCRXOffset();
int ay = (this->geometry().bottomLeft().y() + this->geometry().bottomRight().y()) / 2 + int ay = (this->geometry().bottomLeft().y() + this->geometry().bottomRight().y()) / 2 +
VCRHelper::getVCRYOffset();; VCRHelper::getVCRYOffset();
_vcr_toolbar->move(ax, ay); _vcr_toolbar->move(ax, ay);
} }
@@ -390,7 +389,7 @@ void DicomImageView::LoadSeries(SeriesImageSet *series)
} }
//Callbacks------------------------------------------------------------------------------------ //Callbacks------------------------------------------------------------------------------------
void DicomImageView::updateWindowLevelCb(vtkObject*caller, unsigned long eid, void *calldata) void DicomImageView::updateWindowLevelCb(vtkObject* caller, unsigned long eid, void *calldata)
{ {
_ImageViewer->updateCornerInfo(BOTTOM_RIGHT); _ImageViewer->updateCornerInfo(BOTTOM_RIGHT);
emit Signal_WindowLevelEventForFusion(_ImageViewer->GetColorLevel(), _ImageViewer->GetColorWindow()); emit Signal_WindowLevelEventForFusion(_ImageViewer->GetColorLevel(), _ImageViewer->GetColorWindow());
@@ -421,7 +420,7 @@ void DicomImageView::doubleclickedEventCb(vtkObject* sender, unsigned long event
} }
//TODO重新匹配该函数部分逻辑可以直接保留需要注意Endxxx系列事件不是仅仅为了sync设计的 //TODO重新匹配该函数部分逻辑可以直接保留需要注意Endxxx系列事件不是仅仅为了sync设计的
void DicomImageView::syncEventFunc(vtkObject*caller, unsigned long eid, void *calldata) void DicomImageView::syncEventFunc(vtkObject* caller, unsigned long eid, void *calldata)
{ {
int* r = (int*)calldata; int* r = (int*)calldata;