From: eduardo.davila@creatis.insa-lyon.fr Date: Sun, 19 Oct 2025 16:26:53 +0000 (+0200) Subject: #3583 Bug ReadCreaContourFile order points X-Git-Url: http://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=240a839c8923228d52df696670d012718f3c39df;p=creaMaracasVisu.git #3583 Bug ReadCreaContourFile order points --- diff --git a/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.cxx b/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.cxx index a22888e..6aea2be 100644 --- a/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.cxx +++ b/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.cxx @@ -11,6 +11,10 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ReadCreaContourFile,bbtk::AtomicBlackBox); //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== + + +/* + void ReadCreaContourFile::Process() { @@ -33,7 +37,7 @@ void ReadCreaContourFile::Process() std::vector LstX; std::vector LstY; std::vector LstZ; - std::vector LstIndexs; + std::vector LstIndexs; if (bbGetInputFileNameRoi().compare("")==0) { @@ -106,7 +110,7 @@ void ReadCreaContourFile::Process() LstY.push_back(zz); LstZ.push_back( (y*(-1)) + (dimY-1) ); } // if FromDirection - } // iControlPoint + } // for iControlPoint } // TypeModel fscanf(ff,"%s",tmp); // TypeView fscanf(ff,"%s",tmp); // @@ -118,12 +122,178 @@ void ReadCreaContourFile::Process() } // if --CreaContour-- } // if ff } // if FileNameRoi + + bbSetOutputLstX( LstX ); + bbSetOutputLstY( LstY ); + bbSetOutputLstZ( LstZ ); + bbSetOutputLstIndexs( LstIndexs ); +} + + + */ + + + +void ReadCreaContourFile::Process() +{ + +// THE MAIN PROCESSING METHOD BODY +// Here we simply set the input 'In' value to the output 'Out' +// And print out the output value +// INPUT/OUTPUT ACCESSORS ARE OF THE FORM : +// void bbSet{Input|Output}NAME(const TYPE&) +// const TYPE& bbGet{Input|Output}NAME() const +// Where : +// * NAME is the name of the input/output +// (the one provided in the attribute 'name' of the tag 'input') +// * TYPE is the C++ type of the input/output +// (the one provided in the attribute 'type' of the tag 'input') + +// bbSetOutputOut( bbGetInputIn() ); +// std::cout << "Output value = " < > mapX; + std::map > mapY; + std::map > mapZ; + + if (bbGetInputFileNameRoi().compare("")==0) + { + printf("EED Warnning! ReadCreaContourFile::Process FileNameRoi EMPTY\n"); + } else { + char tmp[255]; + FILE *ff= fopen(bbGetInputFileNameRoi().c_str(),"r"); + if (ff==NULL) + { + printf("EED Warnning! ReadCreaContourFile::Process Wrong file %s\n", bbGetInputFileNameRoi().c_str() ); + } else { + fscanf(ff,"%s",tmp); // --CreaContour-- + std::string tmpStr(tmp); + if (tmpStr.compare("--CreaContour--")==0 ) + { + int iContour,iControlPoint; + int dimX, dimY,dimZ; + int NumberOfContours; + double x,y,z,zz; + int TypeModel; + int NumberOfControlPoints; + fscanf(ff,"%s",tmp); // version + fscanf(ff,"%s",tmp); // + fscanf(ff,"%s",tmp); // ImageDimensions + fscanf(ff,"%d",&dimX); // + fscanf(ff,"%d",&dimY); // + fscanf(ff,"%d",&dimZ); // + fscanf(ff,"%s",tmp); // ImageSpacing + fscanf(ff,"%s",tmp); // + fscanf(ff,"%s",tmp); // + fscanf(ff,"%s",tmp); // + fscanf(ff,"%s",tmp); // NumberOfContours + fscanf(ff,"%d",&NumberOfContours); // + for (iContour=0 ; iContour LstX; + std::vector LstY; + std::vector LstZ; + + fscanf(ff,"%s",tmp); // Instant + fscanf(ff,"%s",tmp); // + fscanf(ff,"%s",tmp); zz=atof(tmp); // zz + fscanf(ff,"%s",tmp); // + fscanf(ff,"%s",tmp); // + fscanf(ff,"%s",tmp); // + fscanf(ff,"%s",tmp); // + fscanf(ff,"%s",tmp); // TypeModel + fscanf(ff,"%d",&TypeModel); // + if ((TypeModel==1) || (TypeModel==6) ) + { + fscanf(ff,"%s",tmp); // NumberOfControlPoints + fscanf(ff,"%d",&NumberOfControlPoints); // +// LstIndexs.push_back( NumberOfControlPoints ); + for (iControlPoint=0 ; iControlPoint LstX; + std::vector LstY; + std::vector LstZ; + std::vector LstIndexs; + + // Order block by zz + for( std::map >::iterator iter = mapX.begin(); + iter != mapX.end(); + ++iter ) + { + int i,size = iter->second.size(); + LstIndexs.push_back( size ); + for (i=0;isecond[i] ); + } // for i + } // for mapX + + for( std::map >::iterator iter = mapY.begin(); + iter != mapY.end(); + ++iter ) + { + int i,size = iter->second.size(); + for (i=0;isecond[i] ); + } // for i + } // for mapY + + for( std::map >::iterator iter = mapZ.begin(); + iter != mapZ.end(); + ++iter ) + { + int i,size = iter->second.size(); + for (i=0;isecond[i] ); + } // for i + } // for mapZ + bbSetOutputLstX( LstX ); bbSetOutputLstY( LstY ); bbSetOutputLstZ( LstZ ); bbSetOutputLstIndexs( LstIndexs ); } + //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx index af5bf57..1980892 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx @@ -373,9 +373,8 @@ void ColorLayerImageView::ConfigLookupTable() // virtual thresholdTable->SetAlphaRange( 0,1 ); thresholdTable->SetValueRange( 0,1 ); - thresholdTable->SetSaturationRange( 0,0 ); - thresholdTable->SetRampToLinear( ); + thresholdTable->SetRampToLinear( ); maxColorsThresholdTable = 1000; thresholdTable->SetNumberOfTableValues( maxColorsThresholdTable+1 ); @@ -428,9 +427,8 @@ void ColorLayerImageView::ConfigLookupTable() // virtual end = GrayLevel_TO_colorTableIndex( GetGreyLevelBoundaries(iColor+1) ); t1 = _transparence_level_boundary[iColor]; t2 = _transparence_level_boundary[iColor+1]; -//printf("EED ColorLayerImageView::ConfigLookupTable Make something with transparence \n"); FillColorTable( start,end, r1,g1,b1, r2,g2,b2, t1,t2 ); - }// for + }// for } //if } // End Of if (!_color_type) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.h index eef0616..757c0bb 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.h @@ -59,10 +59,8 @@ class ColorLayerImageView : public LayerImageBase */ void SetBaseColors(std::vector & base_color); - void SetBaseTransparence(std::vector & base_transparence); - /** * \brief Returns the base color for a given index (first coordinate of the first color being 1, second coordinate of the first color being 2, etc.). * @@ -95,15 +93,9 @@ class ColorLayerImageView : public LayerImageBase * \return The number of base colors. */ int GetBaseColorNb(); - - - void FillColorTable(int start, int end, double r1, double g1, double b1, double r2, double g2, double b2, double t1, double t2); - - int GrayLevel_TO_colorTableIndex( double VALUE ); - - + void FillColorTable(int start, int end, double r1, double g1, double b1, double r2, double g2, double b2, double t1, double t2); + int GrayLevel_TO_colorTableIndex( double VALUE ); private: - int _x2, _y2, _z2; bool _fix_dynamic; void SetDefaultGreyLevelBoundary(); @@ -111,8 +103,6 @@ class ColorLayerImageView : public LayerImageBase virtual void ConfigLookupTable(); int maxColorsThresholdTable; - - //! Base colors for the overlaid image. std::vector _base_color; //! Grey level boundaries. diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx index 37df70c..f2eb66b 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx @@ -446,12 +446,12 @@ void ColorLayerImageViewPanel::onReadImage(wxCommandEvent& event) //---------------------------------------------------------------------------- void ColorLayerImageViewPanel::onThresholdChange(wxCommandEvent& event) { - if (_thresholdGo) - { - GetColorLayerImageViewManager()->onThresholdChange(); - RefreshView(); - //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl; - } // _thresholdGo + if (_thresholdGo) + { + GetColorLayerImageViewManager()->onThresholdChange(); + RefreshView(); + //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl; + } // _thresholdGo } //---------------------------------------------------------------------------- @@ -566,6 +566,5 @@ void ColorLayerImageViewPanel::SetActive(bool active) GetColorLayerImageViewManager()->SetActive( _active ); } - // EOF diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx index 7ec645c..a8953f0 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx @@ -78,14 +78,10 @@ private: LayerImageBase* _layerimagebase; }; - - //--------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------- - - LayerImageBase::LayerImageBase() { _actorPresent = false; @@ -598,7 +594,7 @@ void LayerImageBase::onThreshold() _thresholdActor->SetInputData( _thresholdMapper->GetOutput() ); #endif - _thresholdActor->SetOpacity(_opacity); + _thresholdActor->SetOpacity(_opacity*2); _scalarbarActor->SetLookupTable( _thresholdTable ); // _scalarbarActor->SetLookupTable( _thresholdMapper->GetLookupTable() ); _scalarbarActor->SetTitle("Value"); @@ -640,7 +636,7 @@ void LayerImageBase::onThresholdChangeOpacity (int opacity) _thresholdActor->SetOpacity(opacity/100.0); } // EED 2017-12-17 - _opacity = (double)opacity/100.0; + _opacity = (double)opacity/100.0; } //---------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ThresholdImageView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ThresholdImageView.cxx index 0ab4c87..e1d0cd5 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ThresholdImageView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ThresholdImageView.cxx @@ -85,7 +85,7 @@ void ThresholdImageView::ConfigLookupTable() // virtual thresholdTable->SetNumberOfTableValues( (maxTot-minTot) ); thresholdTable->SetAlphaRange(0, 1); thresholdTable->SetValueRange(0, 1); - thresholdTable->SetSaturationRange(0, 0); + thresholdTable->SetSaturationRange(0, 1); thresholdTable->SetRampToLinear( ); //Assign a fake color for the upper image, and set the white as transparent diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.cpp index 647c6f4..fa9360b 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.cpp @@ -163,7 +163,6 @@ int manualBaseModel::GetIdPoint(double x, double y, double z, int i_range,int t xx=mp->GetX(); yy=mp->GetY(); zz=mp->GetZ(); - if (type==-1) { if ((fabs(xx-x)GetY(); zz=mp->GetZ(); - if (type==-1) + if (type==-1) { if ((fabs(xx-x)