From: Kevin M. Rosenberg Date: Wed, 21 Mar 2018 18:48:31 +0000 (-0600) Subject: Fix all remaining compiler warnings X-Git-Tag: v6.0.2~1 X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=commitdiff_plain;h=e89023477e02d9332f87cab5a7975407625dbd60;ds=sidebyside Fix all remaining compiler warnings --- diff --git a/include/ct.h b/include/ct.h index 84f1e91..4a4734b 100644 --- a/include/ct.h +++ b/include/ct.h @@ -185,5 +185,7 @@ extern "C" { #include "ctglobals.h" -#endif +// Macro to remove compiler warnings about unused variables +#define UNUSED(expr) do { (void)(expr); } while (0) +#endif diff --git a/libctsim/ctndicom.cpp b/libctsim/ctndicom.cpp index 29f2f48..df00792 100644 --- a/libctsim/ctndicom.cpp +++ b/libctsim/ctndicom.cpp @@ -1,13 +1,13 @@ /***************************************************************************** ** FILE IDENTIFICATION ** -** Name: ctndicomp.cpp -** Purpose: Interface to CTN Dicom classes +** Name: ctndicomp.cpp +** Purpose: Interface to CTN Dicom classes ** Programmer: Kevin Rosenberg ** Date Started: March 2001 ** ** This is part of the CTSim program -** Copyright (c) 1983-2009 Kevin Rosenberg +** Copyright (c) 1983-2018 Kevin Rosenberg ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -113,10 +113,10 @@ DicomImporter::loadImage(unsigned short iNRows, unsigned short iNCols, unsigned double dRescaleSlope = 1; double dRescaleIntercept = 0; DCM_ELEMENT elemRescaleSlope = - {DCM_IMGRESCALESLOPE, DCM_DS, "", 1, strlen(szRescaleSlope), + {DCM_IMGRESCALESLOPE, DCM_DS, "", 1, (U32) strlen(szRescaleSlope), {szRescaleSlope}}; DCM_ELEMENT elemRescaleIntercept = - {DCM_IMGRESCALEINTERCEPT, DCM_DS, "", 1, strlen(szRescaleIntercept), + {DCM_IMGRESCALEINTERCEPT, DCM_DS, "", 1, (U32) strlen(szRescaleIntercept), {szRescaleIntercept}}; if (DCM_ParseObject (&m_pFile, &elemRescaleSlope, 1, NULL, 0, NULL) == DCM_NORMAL) { if (sscanf (szRescaleSlope, "%lf", &dRescaleSlope) != 1) @@ -382,56 +382,56 @@ DicomExporter::createDicomObject() {reinterpret_cast(&iPixRep)}}, {DCM_IMGSAMPLESPERPIXEL, DCM_US, "", 1, sizeof(iSamplesPerPixel), {reinterpret_cast(&iSamplesPerPixel)}}, - {DCM_IMGRESCALESLOPE, DCM_DS, "", 1, strlen(szRescaleSlope), + {DCM_IMGRESCALESLOPE, DCM_DS, "", 1, (U32) strlen(szRescaleSlope), {szRescaleSlope}}, - {DCM_IMGRESCALEINTERCEPT, DCM_DS, "", 1, strlen(szRescaleIntercept), + {DCM_IMGRESCALEINTERCEPT, DCM_DS, "", 1, (U32) strlen(szRescaleIntercept), {szRescaleIntercept}}, - {DCM_IMGPHOTOMETRICINTERP, DCM_CS, "", 1, strlen(szImgPhotometricInterp), + {DCM_IMGPHOTOMETRICINTERP, DCM_CS, "", 1, (U32) strlen(szImgPhotometricInterp), {szImgPhotometricInterp}}, - {DCM_IMGPIXELSPACING, DCM_DS, "", 1, strlen(szPixelSpacing), + {DCM_IMGPIXELSPACING, DCM_DS, "", 1, (U32) strlen(szPixelSpacing), {szPixelSpacing}}, {DCM_RELIMAGEORIENTATIONPATIENT, DCM_DS, "", 1, - strlen(szRelImageOrientationPatient), {szRelImageOrientationPatient}}, + (U32) strlen(szRelImageOrientationPatient), {szRelImageOrientationPatient}}, {DCM_RELIMAGEPOSITIONPATIENT, DCM_DS, "", 1, - strlen(szRelImagePositionPatient), {szRelImagePositionPatient}}, - {DCM_ACQKVP, DCM_DS, "", 1, strlen(szAcqKvp), {szAcqKvp}}, - {DCM_RELACQUISITIONNUMBER, DCM_IS, "", 1, strlen(szRelAcquisitionNumber), + (U32) strlen(szRelImagePositionPatient), {szRelImagePositionPatient}}, + {DCM_ACQKVP, DCM_DS, "", 1, (U32) strlen(szAcqKvp), {szAcqKvp}}, + {DCM_RELACQUISITIONNUMBER, DCM_IS, "", 1, (U32) strlen(szRelAcquisitionNumber), {szRelAcquisitionNumber}}, - {DCM_ACQSLICETHICKNESS, DCM_DS, "", 1, strlen(szRelAcquisitionNumber), + {DCM_ACQSLICETHICKNESS, DCM_DS, "", 1, (U32) strlen(szRelAcquisitionNumber), {szRelAcquisitionNumber}}, - {DCM_RELIMAGENUMBER, DCM_IS, "", 1, strlen(szRelImageNumber), + {DCM_RELIMAGENUMBER, DCM_IS, "", 1, (U32) strlen(szRelImageNumber), {szRelImageNumber}}, - {DCM_IDSOPINSTANCEUID, DCM_UI, "", 1, strlen(szIDSOPInstanceUID), + {DCM_IDSOPINSTANCEUID, DCM_UI, "", 1, (U32) strlen(szIDSOPInstanceUID), {szIDSOPInstanceUID}}, - {DCM_IDMANUFACTURER, DCM_LO, "", 1, strlen(szIDManufacturer), + {DCM_IDMANUFACTURER, DCM_LO, "", 1, (U32) strlen(szIDManufacturer), {szIDManufacturer}}, {DCM_RELPOSITIONREFINDICATOR, DCM_LO, "", 1, - strlen(szRelPositionRefIndicator), {szRelPositionRefIndicator}}, + (U32) strlen(szRelPositionRefIndicator), {szRelPositionRefIndicator}}, {DCM_RELFRAMEOFREFERENCEUID, DCM_UI, "", 1, - strlen(szRelFrameOfReferenceUID), {szRelFrameOfReferenceUID}}, - {DCM_RELSERIESNUMBER, DCM_IS, "", 1, strlen(szRelSeriesNumber), + (U32) strlen(szRelFrameOfReferenceUID), {szRelFrameOfReferenceUID}}, + {DCM_RELSERIESNUMBER, DCM_IS, "", 1, (U32) strlen(szRelSeriesNumber), {szRelSeriesNumber}}, - {DCM_RELSERIESINSTANCEUID, DCM_UI, "", 1, strlen(szIDAccessionNumber), + {DCM_RELSERIESINSTANCEUID, DCM_UI, "", 1, (U32) strlen(szIDAccessionNumber), {szIDAccessionNumber}}, - {DCM_IDACCESSIONNUMBER, DCM_SH, "", 1, strlen(szIDAccessionNumber), + {DCM_IDACCESSIONNUMBER, DCM_SH, "", 1, (U32) strlen(szIDAccessionNumber), {szIDAccessionNumber}}, - {DCM_RELSTUDYID, DCM_SH, "", 1, strlen(szRelStudyID), {szRelStudyID}}, - {DCM_IDREFERRINGPHYSICIAN, DCM_PN, "", 1, strlen(szIDReferringPhysician), + {DCM_RELSTUDYID, DCM_SH, "", 1, (U32) strlen(szRelStudyID), {szRelStudyID}}, + {DCM_IDREFERRINGPHYSICIAN, DCM_PN, "", 1, (U32) strlen(szIDReferringPhysician), {szIDReferringPhysician}}, - {DCM_IDSTUDYTIME, DCM_TM, "", 1, strlen(szIDStudyTime), {szIDStudyTime}}, - {DCM_IDSTUDYDATE, DCM_DA, "", 1, strlen(szIDStudyDate), {szIDStudyDate}}, - {DCM_RELSTUDYINSTANCEUID, DCM_UI, "", 1, strlen(szRelStudyInstanceUID), + {DCM_IDSTUDYTIME, DCM_TM, "", 1, (U32) strlen(szIDStudyTime), {szIDStudyTime}}, + {DCM_IDSTUDYDATE, DCM_DA, "", 1, (U32) strlen(szIDStudyDate), {szIDStudyDate}}, + {DCM_RELSTUDYINSTANCEUID, DCM_UI, "", 1, (U32) strlen(szRelStudyInstanceUID), {szRelStudyInstanceUID}}, - {DCM_PATSEX, DCM_CS, "", 1, strlen(szPatSex), {szPatSex}}, - {DCM_PATBIRTHDATE, DCM_DA, "", 1, strlen(szPatBirthdate), {szPatBirthdate}}, - {DCM_PATID, DCM_LO, "", 1, strlen(szPatID), {szPatID}}, - {DCM_PATNAME, DCM_PN, "", 1, strlen(szPatName), {szPatName}}, - {DCM_IDIMAGETYPE, DCM_CS, "", 1, strlen(szIDImageType), {szIDImageType}}, - {DCM_IDMODALITY, DCM_CS, "", 1, strlen(szModality), {szModality}}, - {DCM_IDSOPCLASSUID, DCM_UI, "", 1, strlen(szSOPClassUID), {szSOPClassUID}}, - {DCM_IDMANUFACTURERMODEL, DCM_LO, "", 1, strlen(szIDManufacturerModel), + {DCM_PATSEX, DCM_CS, "", 1, (U32) strlen(szPatSex), {szPatSex}}, + {DCM_PATBIRTHDATE, DCM_DA, "", 1, (U32) strlen(szPatBirthdate), {szPatBirthdate}}, + {DCM_PATID, DCM_LO, "", 1, (U32) strlen(szPatID), {szPatID}}, + {DCM_PATNAME, DCM_PN, "", 1, (U32) strlen(szPatName), {szPatName}}, + {DCM_IDIMAGETYPE, DCM_CS, "", 1, (U32) strlen(szIDImageType), {szIDImageType}}, + {DCM_IDMODALITY, DCM_CS, "", 1, (U32) strlen(szModality), {szModality}}, + {DCM_IDSOPCLASSUID, DCM_UI, "", 1, (U32) strlen(szSOPClassUID), {szSOPClassUID}}, + {DCM_IDMANUFACTURERMODEL, DCM_LO, "", 1, (U32) strlen(szIDManufacturerModel), {szIDManufacturerModel}}, - {DCM_PATCOMMENTS, DCM_LT, "", 1, strlen(pszPatComments), {pszPatComments}}, + {DCM_PATCOMMENTS, DCM_LT, "", 1, (U32) strlen(pszPatComments), {pszPatComments}}, }; int nElemRequired = sizeof (aElemRequired) / sizeof(DCM_ELEMENT); diff --git a/scripts/compare-2ver.sh b/scripts/compare-2ver.sh deleted file mode 100755 index fa0666c..0000000 --- a/scripts/compare-2ver.sh +++ /dev/null @@ -1,24 +0,0 @@ -PR=1001 -PV=601 -IX=501 -TIME= - -BIN1=../tools/ctsimtext -BIN2=../tools/single/ctsimtext - -echo -n "$BIN1 Prj: "; $TIME $BIN1 phm2pj ~/herman-omp.pj $PR $PV --phantom herman --verbose | tail -1 -echo -n "$BIN2 Prj: "; $TIME $BIN2 phm2pj ~/herman-s.pj $PR $PV --phantom herman --verbose| tail -1 - -for BP in idiff diff; do - for INT in nearest linear cubic; do - - echo -n "$BIN1 Rec $BP $INT: "; $TIME $BIN1 pjrec ~/herman-omp.pj ~/rec-omp.if $IX $IX --verbose --interp $INT --backproj $BP | tail -1 - echo -n "$BIN2 Rec $BP $INT: "; $TIME $BIN2 pjrec ~/herman-s.pj ~/rec-s.if $IX $IX --verbose --interp $INT --backproj $BP| tail -1 - echo -n "--> Image diff Rec $BP $INT: "; $BIN1 if2 ~/rec-omp.if ~/rec-s.if --comp - echo - done -done - -echo -n "$BIN1 Phm: "; $TIME $BIN1 phm2if ~/phm-omp.if $IX $IX --phantom herman --nsample 5 --verbose | tail -1 -echo -n "$BIN2 Phm: "; $TIME $BIN2 phm2if ~/phm-s.if $IX $IX --phantom herman --nsample 5 --verbose | tail -1 -echo -n "--> Image diff Phantom: "; $BIN1 if2 ~/phm-omp.if ~/phm-s.if --comp diff --git a/src/ctsim.cpp b/src/ctsim.cpp index e2e3f27..2d85a47 100644 --- a/src/ctsim.cpp +++ b/src/ctsim.cpp @@ -730,7 +730,7 @@ MainFrame::OnUpdateUI (wxUpdateUIEvent& rEvent) strFilename += _T("\tCtrl-"); strFilename += static_cast('0' + iPos); } - static_cast(m_apWindowMenuItems[iPos])->SetName (strFilename); + static_cast(m_apWindowMenuItems[iPos])->SetItemLabel (strFilename); m_apWindowMenuData[iPos] = pDoc; m_pWindowMenu->Enable (MAINMENU_WINDOW_BASE+iPos, true); iPos++; @@ -738,7 +738,7 @@ MainFrame::OnUpdateUI (wxUpdateUIEvent& rEvent) } for (int i = iPos; i < MAX_WINDOW_MENUITEMS; i++) { m_pWindowMenu->Enable (MAINMENU_WINDOW_BASE+i, false); - static_cast(m_apWindowMenuItems[i])->SetName (_T("[EMPTY]")); + static_cast(m_apWindowMenuItems[i])->SetItemLabel (_T("[EMPTY]")); m_apWindowMenuData[i] = NULL; } #endif diff --git a/src/views.cpp b/src/views.cpp index ea03d88..7e6de1d 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -340,7 +340,7 @@ ImageFileView::OnScaleMinMax (wxCommandEvent& event) { const ImageFile& rIF = GetDocument()->getImageFile(); double min, max; - if (! m_bMinSpecified && ! m_bMaxSpecified) + if (! m_bMinSpecified || ! m_bMaxSpecified) rIF.getMinMax (min, max); if (m_bMinSpecified) diff --git a/tools/if1.cpp b/tools/if1.cpp index e823255..cd97513 100644 --- a/tools/if1.cpp +++ b/tools/if1.cpp @@ -73,7 +73,8 @@ if1_main (int argc, char *const argv[]) int opt_exp = 0; int opt_sqr = 0; int opt_sqrt = 0; - + UNUSED(opt_verbose); + while (1) { int c = getopt_long (argc, argv, "", my_options, NULL); diff --git a/tools/if2.cpp b/tools/if2.cpp index bc984c8..efd0554 100644 --- a/tools/if2.cpp +++ b/tools/if2.cpp @@ -86,7 +86,8 @@ if2_main (int argc, char *const argv[]) int opt_rowPlot = -1; int opt_columnPlot = -1; Timer timerProgram; - + UNUSED(opt_verbose); + while (1) { char* endptr; int c = getopt_long (argc, argv, "", my_options, NULL); @@ -182,19 +183,20 @@ if2_main (int argc, char *const argv[]) return(1); } - ImageFileArray v1 = im_in1.getArray(); - ImageFileArray v2 = im_in2.getArray(); - ImageFileArray vout = NULL; - if (opt_bImageOutputFile && opt_bPlotOutputFile) { sys_error (ERR_SEVERE, "Both Image and Plot output files can not be selected simultaneously"); return (1); } + + ImageFileArray v1 = im_in1.getArray(); + ImageFileArray v2 = im_in2.getArray(); + ImageFileArray vout = NULL; if (opt_bImageOutputFile) { pim_out = new ImageFile (im_in1.nx(), im_in1.ny()); vout = pim_out->getArray(); } - + UNUSED(vout); + std::string strOperation; int nx = im_in1.nx(); int ny = im_in1.ny(); diff --git a/tools/ifexport.cpp b/tools/ifexport.cpp index f40a34d..19d8520 100644 --- a/tools/ifexport.cpp +++ b/tools/ifexport.cpp @@ -125,7 +125,9 @@ ifexport_main (int argc, char *const argv[]) int opt_center = O_CENTER_MEDIAN; int opt_format = O_FORMAT_PGM; int opt_labels = 0; - + UNUSED(opt_verbose); + UNUSED(opt_debug); + while (1) { int c = getopt_long (argc, argv, "", my_options, NULL); diff --git a/tools/ifinfo.cpp b/tools/ifinfo.cpp index 7dd85f8..e2e522e 100644 --- a/tools/ifinfo.cpp +++ b/tools/ifinfo.cpp @@ -74,7 +74,9 @@ ifinfo_main (int argc, char *const argv[]) int opt_stats = 1; int opt_labels = 1; int opt_debug = 0; - + UNUSED(opt_verbose); + UNUSED(opt_debug); + while (1) { int c = getopt_long (argc, argv, "", my_options, NULL); diff --git a/tools/linogram.cpp b/tools/linogram.cpp index 45c45f1..fe9a0f6 100644 --- a/tools/linogram.cpp +++ b/tools/linogram.cpp @@ -64,7 +64,9 @@ linogram_main (int argc, char *const argv[]) int opt_xy = 0; int opt_verbose = 0; int opt_debug = 0; - + UNUSED(opt_verbose); + UNUSED(opt_debug); + while (1) { int c = getopt_long (argc, argv, "", my_options, NULL); diff --git a/tools/phm2if.cpp b/tools/phm2if.cpp index ce08c25..040f7e1 100644 --- a/tools/phm2if.cpp +++ b/tools/phm2if.cpp @@ -121,6 +121,8 @@ phm2if_main (int argc, char* const argv[]) char *endstr; Timer timerProgram; + UNUSED(optDebug); + #ifdef HAVE_MPI ImageFile* pImLocal = NULL; MPIWorld mpiWorld (argc, argv); diff --git a/tools/phm2pj.cpp b/tools/phm2pj.cpp index bedd83b..7fa9bde 100644 --- a/tools/phm2pj.cpp +++ b/tools/phm2pj.cpp @@ -120,7 +120,8 @@ phm2pj_main (int argc, char* const argv[]) double opt_rotangle = -1; char* endptr = NULL; char* endstr; - + UNUSED(opt_debug); + #ifdef HAVE_MPI MPIWorld mpiWorld (argc, argv); #endif diff --git a/tools/pjHinterp.cpp b/tools/pjHinterp.cpp index bd16744..1e6ef31 100644 --- a/tools/pjHinterp.cpp +++ b/tools/pjHinterp.cpp @@ -65,12 +65,13 @@ pjHinterp_main(int argc, char * const argv[]) char* pszProjFilename = NULL; char* pszInterpFilename = NULL; bool bOptVerbose = false; - bool bOptDebug = 1; + bool bOptDebug = false; int optTrace = Trace::TRACE_NONE; char *endptr = NULL; char *endstr; int opt_interpview=-1; - + UNUSED(bOptDebug); + while (1) { int c = getopt_long(argc, argv, "", my_options, NULL); diff --git a/tools/pjrec.cpp b/tools/pjrec.cpp index 5aa16d0..f61b8bf 100644 --- a/tools/pjrec.cpp +++ b/tools/pjrec.cpp @@ -125,7 +125,7 @@ pjrec_main (int argc, char * const argv[]) char* pszFilenameImage = NULL; std::string sRemark; bool bOptVerbose = false; - bool bOptDebug = 1; + bool bOptDebug = false; int iOptZeropad = 1; int optTrace = Trace::TRACE_NONE; double dOptFilterParam = -1; @@ -137,6 +137,8 @@ pjrec_main (int argc, char * const argv[]) int iOptPreinterpolationFactor = 1; int nx, ny; char *endptr; + UNUSED(bOptDebug); + #ifdef HAVE_MPI ImageFile* imLocal; int mpi_nview, mpi_ndet;