OSDN Git Service

ticket: #34963 mrcImageMeanFreePath : pixel -> Angstrom : -m +16 v2.2.12p0018
authorTakuo Yasunaga <yasunaga@bio.kyutech.ac.jp>
Sat, 7 Mar 2015 09:32:20 +0000 (18:32 +0900)
committerTakuo Yasunaga <yasunaga@bio.kyutech.ac.jp>
Sat, 7 Mar 2015 09:32:20 +0000 (18:32 +0900)
ticket: #34814 mrcImageShapeSearch  : Cylinder

15 files changed:
bin/wish/Display2/tclIndex
src/Tools/Config/Define.inc
src/Tools/mrcImage/mrcImageMeanFreePathCalc/src/mrcImageMeanFreePathCalc.c
src/Tools/mrcImage/mrcImageMeanFreePathCalc/src/test/Makefile
src/Tools/mrcImage/mrcImageShapeSearch/Config/OptionControlFile
src/Tools/mrcImage/mrcImageShapeSearch/inc/mrcImageShapeSearch.h
src/Tools/mrcImage/mrcImageShapeSearch/src/argCheck.c
src/Tools/mrcImage/mrcImageShapeSearch/src/init.c
src/Tools/mrcImage/mrcImageShapeSearch/src/mrcImageShapeSearch.c
src/Tools/mrcImage/mrcImageShapeSearch/src/mrcImageShapeSearch.html [changed mode: 0644->0755]
src/Tools/mrcImage/mrcImageShapeSearch/src/mrcImageShapeSearch.pane
src/Tools/mrcImage/mrcImageShapeSearch/src/test/Makefile [new file with mode: 0755]
src/Tools/mrcImage/mrcImageShapeSearch/src/test/data [new symlink]
src/Tools/mrcImage/mrcImageShapeSearch/src/usage.c
util/src/Graphics/Makefile

index e727737..8fd9302 100644 (file)
@@ -6,38 +6,41 @@
 # element name is the name of a command and the value is
 # a script that loads the command.
 
-set auto_index(roiAreaRotateStart) [list source [file join $dir RoiAreaRotate.wish]]
-set auto_index(roiAreaRotateMotion) [list source [file join $dir RoiAreaRotate.wish]]
-set auto_index(roiAreaRotateEnd) [list source [file join $dir RoiAreaRotate.wish]]
-set auto_index(rectangleRotate) [list source [file join $dir RoiAreaRotate.wish]]
-set auto_index(rectangleRotateCalc) [list source [file join $dir RoiAreaRotate.wish]]
-set auto_index(lineRotate) [list source [file join $dir RoiAreaRotate.wish]]
-set auto_index(lineRotateCalc) [list source [file join $dir RoiAreaRotate.wish]]
-set auto_index(splineRotate) [list source [file join $dir RoiAreaRotate.wish]]
-set auto_index(splineRotateCalc) [list source [file join $dir RoiAreaRotate.wish]]
-set auto_index(roiAreaSelectStart) [list source [file join $dir RoiAreaSelect.wish]]
-set auto_index(roiAreaSelectMotion) [list source [file join $dir RoiAreaSelect.wish]]
-set auto_index(roiAreaSelectEnd) [list source [file join $dir RoiAreaSelect.wish]]
-set auto_index(roiAreaSelectOK) [list source [file join $dir RoiAreaSelect.wish]]
+set auto_index(display2BindingSet) [list source [file join $dir Display2Binding.wish]]
 set auto_index(colormapChange) [list source [file join $dir Display2Colormap.wish]]
+set auto_index(display2DesktopSet) [list source [file join $dir Display2Desktop.wish]]
+set auto_index(display2ETCSet) [list source [file join $dir Display2ETCSet.wish]]
+set auto_index(fileOpenWinCreate) [list source [file join $dir Display2File.wish]]
+set auto_index(fileNewWinCreate) [list source [file join $dir Display2File.wish]]
+set auto_index(seqFileOpenWinCreate) [list source [file join $dir Display2File.wish]]
+set auto_index(seqFileNewWinCreate) [list source [file join $dir Display2File.wish]]
+set auto_index(fileOpen) [list source [file join $dir Display2Image.wish]]
+set auto_index(mainImagePut) [list source [file join $dir Display2Image.wish]]
+set auto_index(overviewImagePut) [list source [file join $dir Display2Image.wish]]
+set auto_index(histgramGraphCreate) [list source [file join $dir Display2Info.wish]]
+set auto_index(display2InformationWinCreate) [list source [file join $dir Display2Info.wish]]
+set auto_index(fileReopen) [list source [file join $dir Display2Info.wish]]
+set auto_index(mrcImageInformationWinCreate) [list source [file join $dir Display2Info.wish]]
+set auto_index(imageInformationWinCreate) [list source [file join $dir Display2Info.wish]]
+set auto_index(layerLineInformationWinCreate) [list source [file join $dir Display2Info.wish]]
+set auto_index(projectionInformationWinCreate) [list source [file join $dir Display2Info.wish]]
+set auto_index(sectionInformationWinCreate) [list source [file join $dir Display2Info.wish]]
+set auto_index(ctfInformationWinCreate) [list source [file join $dir Display2Info.wish]]
+set auto_index(unitCellInformationWinCreate) [list source [file join $dir Display2Info.wish]]
+set auto_index(scaleInfoWinCreate) [list source [file join $dir Display2Info.wish]]
+set auto_index(roiInformationWinCreate) [list source [file join $dir Display2InfoROI.wish]]
+set auto_index(roiLineInfoFrameCreate) [list source [file join $dir Display2InfoROI.wish]]
+set auto_index(roiSplineInfoFrameCreate) [list source [file join $dir Display2InfoROI.wish]]
+set auto_index(roiRectangleInfoFrameCreate) [list source [file join $dir Display2InfoROI.wish]]
+set auto_index(roiAnalysisFrameCreate) [list source [file join $dir Display2InfoROI.wish]]
+set auto_index(display2Init) [list source [file join $dir Display2Init.wish]]
+set auto_index(display2MenuSet) [list source [file join $dir Display2Menu.wish]]
+set auto_index(menuFileCreate) [list source [file join $dir Display2Menu.wish]]
+set auto_index(menuSeqFileCreate) [list source [file join $dir Display2Menu.wish]]
+set auto_index(menuWindowCreate) [list source [file join $dir Display2Menu.wish]]
+set auto_index(menuInfoCreate) [list source [file join $dir Display2Menu.wish]]
+set auto_index(menuHelpCreate) [list source [file join $dir Display2Menu.wish]]
 set auto_index(display2MenuSet2) [list source [file join $dir Display2Menu2.wish]]
-set auto_index(fft2dCmd) [list source [file join $dir fft2dCmd.wish]]
-set auto_index(display2BindingSet) [list source [file join $dir Display2Binding.wish]]
-set auto_index(roiMultiAreaInfoSave) [list source [file join $dir RoiAreaFile.wish]]
-set auto_index(roiMultiAreaInfoLoad) [list source [file join $dir RoiAreaFile.wish]]
-set auto_index(roiAreaFileSave) [list source [file join $dir RoiAreaFile.wish]]
-set auto_index(roiAreaFFT) [list source [file join $dir RoiAreaUtil.wish]]
-set auto_index(splineNearPoint) [list source [file join $dir RoiAreaUtil.wish]]
-set auto_index(rectangleNearPoint) [list source [file join $dir RoiAreaUtil.wish]]
-set auto_index(lineNearPoint) [list source [file join $dir RoiAreaUtil.wish]]
-set auto_index(pointDistance) [list source [file join $dir RoiAreaUtil.wish]]
-set auto_index(pointDistance2) [list source [file join $dir RoiAreaUtil.wish]]
-set auto_index(vectorAngle) [list source [file join $dir RoiAreaUtil.wish]]
-set auto_index(coordGetInMainImageToReal) [list source [file join $dir RoiAreaUtil.wish]]
-set auto_index(coordGetInMainImageToCanvas) [list source [file join $dir RoiAreaUtil.wish]]
-set auto_index(dataGetInMainImageToReal) [list source [file join $dir RoiAreaUtil.wish]]
-set auto_index(dataGetInMainImageToCanvas) [list source [file join $dir RoiAreaUtil.wish]]
-set auto_index(pointSet) [list source [file join $dir RoiAreaUtil.wish]]
 set auto_index(roiRelatedObjectRecreate) [list source [file join $dir Display2MenuROI.wish]]
 set auto_index(menuRoiCreate) [list source [file join $dir Display2MenuROI.wish]]
 set auto_index(menuRoiCancelCommand) [list source [file join $dir Display2MenuROI.wish]]
@@ -46,38 +49,15 @@ set auto_index(menuMultiRoiOKCommand) [list source [file join $dir Display2MenuR
 set auto_index(menuMultiRoiAllDeleteCommand) [list source [file join $dir Display2MenuROI.wish]]
 set auto_index(menuMultiRoiDeleteCommand) [list source [file join $dir Display2MenuROI.wish]]
 set auto_index(menuEditCreate) [list source [file join $dir Display2MenuROI.wish]]
-set auto_index(display2Init) [list source [file join $dir Display2Init.wish]]
-set auto_index(display2MenuSet) [list source [file join $dir Display2Menu.wish]]
-set auto_index(menuFileCreate) [list source [file join $dir Display2Menu.wish]]
-set auto_index(menuSeqFileCreate) [list source [file join $dir Display2Menu.wish]]
-set auto_index(menuWindowCreate) [list source [file join $dir Display2Menu.wish]]
-set auto_index(menuInfoCreate) [list source [file join $dir Display2Menu.wish]]
-set auto_index(menuHelpCreate) [list source [file join $dir Display2Menu.wish]]
-set auto_index(roiAreaResizeStart) [list source [file join $dir RoiAreaResize.wish]]
-set auto_index(roiAreaResizeMotion) [list source [file join $dir RoiAreaResize.wish]]
-set auto_index(roiAreaResizeEnd) [list source [file join $dir RoiAreaResize.wish]]
-set auto_index(rectangleResize) [list source [file join $dir RoiAreaResize.wish]]
-set auto_index(rectangleResizeCalc) [list source [file join $dir RoiAreaResize.wish]]
-set auto_index(lineResize) [list source [file join $dir RoiAreaResize.wish]]
-set auto_index(splineResize) [list source [file join $dir RoiAreaResize.wish]]
+set auto_index(fft2dCmd) [list source [file join $dir fft2dCmd.wish]]
 set auto_index(layerLineRecreate) [list source [file join $dir LayerLineUtil.wish]]
 set auto_index(layerLineCreate) [list source [file join $dir LayerLineUtil.wish]]
 set auto_index(layerLineClear) [list source [file join $dir LayerLineUtil.wish]]
 set auto_index(layerLineChange) [list source [file join $dir LayerLineUtil.wish]]
-set auto_index(histgramGraphCreate) [list source [file join $dir Display2Info.wish]]
-set auto_index(display2InformationWinCreate) [list source [file join $dir Display2Info.wish]]
-set auto_index(fileReopen) [list source [file join $dir Display2Info.wish]]
-set auto_index(mrcImageInformationWinCreate) [list source [file join $dir Display2Info.wish]]
-set auto_index(imageInformationWinCreate) [list source [file join $dir Display2Info.wish]]
-set auto_index(layerLineInformationWinCreate) [list source [file join $dir Display2Info.wish]]
-set auto_index(projectionInformationWinCreate) [list source [file join $dir Display2Info.wish]]
-set auto_index(sectionInformationWinCreate) [list source [file join $dir Display2Info.wish]]
-set auto_index(ctfInformationWinCreate) [list source [file join $dir Display2Info.wish]]
-set auto_index(unitCellInformationWinCreate) [list source [file join $dir Display2Info.wish]]
-set auto_index(scaleInfoWinCreate) [list source [file join $dir Display2Info.wish]]
-set auto_index(roiAreaZoomIn) [list source [file join $dir RoiAreaZoom.wish]]
-set auto_index(roiAreaZoomOut) [list source [file join $dir RoiAreaZoom.wish]]
-set auto_index(roiAreaZoom) [list source [file join $dir RoiAreaZoom.wish]]
+set auto_index(projectionRecreate) [list source [file join $dir ProjectionUtil.wish]]
+set auto_index(projectionCreate) [list source [file join $dir ProjectionUtil.wish]]
+set auto_index(projectionClear) [list source [file join $dir ProjectionUtil.wish]]
+set auto_index(projectionChange) [list source [file join $dir ProjectionUtil.wish]]
 set auto_index(roiAreaCreateStart) [list source [file join $dir RoiAreaCreate.wish]]
 set auto_index(roiAreaCreateMotion) [list source [file join $dir RoiAreaCreate.wish]]
 set auto_index(roiAreaCreateEnd) [list source [file join $dir RoiAreaCreate.wish]]
@@ -95,29 +75,54 @@ set auto_index(roiSplineEnd) [list source [file join $dir RoiAreaCreate.wish]]
 set auto_index(splineCreate) [list source [file join $dir RoiAreaCreate.wish]]
 set auto_index(knobShow) [list source [file join $dir RoiAreaCreate.wish]]
 set auto_index(knobHide) [list source [file join $dir RoiAreaCreate.wish]]
-set auto_index(fileOpenWinCreate) [list source [file join $dir Display2File.wish]]
-set auto_index(fileNewWinCreate) [list source [file join $dir Display2File.wish]]
-set auto_index(seqFileOpenWinCreate) [list source [file join $dir Display2File.wish]]
-set auto_index(seqFileNewWinCreate) [list source [file join $dir Display2File.wish]]
-set auto_index(ScaleRecreate) [list source [file join $dir ScaleUtil.wish]]
-set auto_index(ScaleCreate) [list source [file join $dir ScaleUtil.wish]]
-set auto_index(ScaleClear) [list source [file join $dir ScaleUtil.wish]]
-set auto_index(ScaleChange) [list source [file join $dir ScaleUtil.wish]]
-set auto_index(unitCellRecreate) [list source [file join $dir UnitCell.wish]]
-set auto_index(fileOpen) [list source [file join $dir Display2Image.wish]]
-set auto_index(mainImagePut) [list source [file join $dir Display2Image.wish]]
-set auto_index(overviewImagePut) [list source [file join $dir Display2Image.wish]]
+set auto_index(roiMultiAreaInfoSave) [list source [file join $dir RoiAreaFile.wish]]
+set auto_index(roiMultiAreaInfoLoad) [list source [file join $dir RoiAreaFile.wish]]
+set auto_index(roiAreaFileSave) [list source [file join $dir RoiAreaFile.wish]]
 set auto_index(roiAreaMoveStart) [list source [file join $dir RoiAreaMove.wish]]
 set auto_index(roiAreaMoveMotion) [list source [file join $dir RoiAreaMove.wish]]
 set auto_index(roiAreaMoveEnd) [list source [file join $dir RoiAreaMove.wish]]
 set auto_index(rectangleMove) [list source [file join $dir RoiAreaMove.wish]]
 set auto_index(lineMove) [list source [file join $dir RoiAreaMove.wish]]
 set auto_index(splineMove) [list source [file join $dir RoiAreaMove.wish]]
-set auto_index(roiInformationWinCreate) [list source [file join $dir Display2InfoROI.wish]]
-set auto_index(roiLineInfoFrameCreate) [list source [file join $dir Display2InfoROI.wish]]
-set auto_index(roiSplineInfoFrameCreate) [list source [file join $dir Display2InfoROI.wish]]
-set auto_index(roiRectangleInfoFrameCreate) [list source [file join $dir Display2InfoROI.wish]]
-set auto_index(roiAnalysisFrameCreate) [list source [file join $dir Display2InfoROI.wish]]
+set auto_index(roiAreaResizeStart) [list source [file join $dir RoiAreaResize.wish]]
+set auto_index(roiAreaResizeMotion) [list source [file join $dir RoiAreaResize.wish]]
+set auto_index(roiAreaResizeEnd) [list source [file join $dir RoiAreaResize.wish]]
+set auto_index(rectangleResize) [list source [file join $dir RoiAreaResize.wish]]
+set auto_index(rectangleResizeCalc) [list source [file join $dir RoiAreaResize.wish]]
+set auto_index(lineResize) [list source [file join $dir RoiAreaResize.wish]]
+set auto_index(splineResize) [list source [file join $dir RoiAreaResize.wish]]
+set auto_index(roiAreaRotateStart) [list source [file join $dir RoiAreaRotate.wish]]
+set auto_index(roiAreaRotateMotion) [list source [file join $dir RoiAreaRotate.wish]]
+set auto_index(roiAreaRotateEnd) [list source [file join $dir RoiAreaRotate.wish]]
+set auto_index(rectangleRotate) [list source [file join $dir RoiAreaRotate.wish]]
+set auto_index(rectangleRotateCalc) [list source [file join $dir RoiAreaRotate.wish]]
+set auto_index(lineRotate) [list source [file join $dir RoiAreaRotate.wish]]
+set auto_index(lineRotateCalc) [list source [file join $dir RoiAreaRotate.wish]]
+set auto_index(splineRotate) [list source [file join $dir RoiAreaRotate.wish]]
+set auto_index(splineRotateCalc) [list source [file join $dir RoiAreaRotate.wish]]
+set auto_index(roiAreaSelectStart) [list source [file join $dir RoiAreaSelect.wish]]
+set auto_index(roiAreaSelectMotion) [list source [file join $dir RoiAreaSelect.wish]]
+set auto_index(roiAreaSelectEnd) [list source [file join $dir RoiAreaSelect.wish]]
+set auto_index(roiAreaSelectOK) [list source [file join $dir RoiAreaSelect.wish]]
+set auto_index(roiAreaFFT) [list source [file join $dir RoiAreaUtil.wish]]
+set auto_index(splineNearPoint) [list source [file join $dir RoiAreaUtil.wish]]
+set auto_index(rectangleNearPoint) [list source [file join $dir RoiAreaUtil.wish]]
+set auto_index(lineNearPoint) [list source [file join $dir RoiAreaUtil.wish]]
+set auto_index(pointDistance) [list source [file join $dir RoiAreaUtil.wish]]
+set auto_index(pointDistance2) [list source [file join $dir RoiAreaUtil.wish]]
+set auto_index(vectorAngle) [list source [file join $dir RoiAreaUtil.wish]]
+set auto_index(coordGetInMainImageToReal) [list source [file join $dir RoiAreaUtil.wish]]
+set auto_index(coordGetInMainImageToCanvas) [list source [file join $dir RoiAreaUtil.wish]]
+set auto_index(dataGetInMainImageToReal) [list source [file join $dir RoiAreaUtil.wish]]
+set auto_index(dataGetInMainImageToCanvas) [list source [file join $dir RoiAreaUtil.wish]]
+set auto_index(pointSet) [list source [file join $dir RoiAreaUtil.wish]]
+set auto_index(roiAreaZoomIn) [list source [file join $dir RoiAreaZoom.wish]]
+set auto_index(roiAreaZoomOut) [list source [file join $dir RoiAreaZoom.wish]]
+set auto_index(roiAreaZoom) [list source [file join $dir RoiAreaZoom.wish]]
+set auto_index(ScaleRecreate) [list source [file join $dir ScaleUtil.wish]]
+set auto_index(ScaleCreate) [list source [file join $dir ScaleUtil.wish]]
+set auto_index(ScaleClear) [list source [file join $dir ScaleUtil.wish]]
+set auto_index(ScaleChange) [list source [file join $dir ScaleUtil.wish]]
 set auto_index(sectionInit) [list source [file join $dir SectionUtil.wish]]
 set auto_index(sectionRecreateAll) [list source [file join $dir SectionUtil.wish]]
 set auto_index(sectionRecreate) [list source [file join $dir SectionUtil.wish]]
@@ -126,9 +131,4 @@ set auto_index(sectionCreate) [list source [file join $dir SectionUtil.wish]]
 set auto_index(sectionClearAll) [list source [file join $dir SectionUtil.wish]]
 set auto_index(sectionClear) [list source [file join $dir SectionUtil.wish]]
 set auto_index(sectionChange) [list source [file join $dir SectionUtil.wish]]
-set auto_index(display2DesktopSet) [list source [file join $dir Display2Desktop.wish]]
-set auto_index(display2ETCSet) [list source [file join $dir Display2ETCSet.wish]]
-set auto_index(projectionRecreate) [list source [file join $dir ProjectionUtil.wish]]
-set auto_index(projectionCreate) [list source [file join $dir ProjectionUtil.wish]]
-set auto_index(projectionClear) [list source [file join $dir ProjectionUtil.wish]]
-set auto_index(projectionChange) [list source [file join $dir ProjectionUtil.wish]]
+set auto_index(unitCellRecreate) [list source [file join $dir UnitCell.wish]]
index 5909c89..0a1d2d9 100755 (executable)
@@ -555,3 +555,13 @@ WORLDNAME=Tools
 WORLDNAME=Tools
 WORLDNAME=Tools
 WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
+WORLDNAME=Tools
index c2c63bf..5c29731 100755 (executable)
 #define GLOBAL_DECLARATION
 #include "../inc/config.h"
 
-#define DEBUG
+#undef DEBUG
 #include "genUtil.h"
-#include "mrcImage.h"
 #include "Memory.h"
+#include "mrcImage.h"
+#include "lmrcImageMultiplying.h"
 
 typedef struct lmrcImageMeanFreePathCalcInfo {
        int  N;
@@ -48,6 +49,8 @@ typedef struct lmrcImageMeanFreePathCalcInfo {
 
 typedef enum lmrcImageMeanFreePathCalcMode {
        MeanFreePathCalcModeAlongZaxis=0,
+       MeanFreePathCalcModeCalcMode=0x0f,
+       MeanFreePathCalcModeRealLength=0x10
 } lmrcImageMeanFreePathCalcMode;
 
 extern void lmrcImageMeanFreePathCalcPrint(FILE* fpt, lmrcImageMeanFreePathCalcInfo* linfo, lmrcImageMeanFreePathCalcMode mode);
@@ -89,7 +92,7 @@ main(int argc, char* argv[])
        if(info.flagOutBlackEdge) {
                mrcFileWrite(&linfo.blackEdge, info.OutBlackEdge, "in main", 0);
        }
-       exit(EXIT_SUCCESS);
+       return EXIT_SUCCESS;
 }
 
 void
@@ -109,14 +112,18 @@ lmrcImageMeanFreePathCalcModePrint(FILE* fpt)
 void
 lmrcImageMeanFreePathCalc(mrcImage* in, lmrcImageMeanFreePathCalcInfo* linfo, lmrcImageMeanFreePathCalcMode mode)
 {
-       switch(mode) {
+       DEBUGPRINT1("mode: %d in Calc 1st \n", mode);
+       switch(MeanFreePathCalcModeCalcMode&mode) {
                case MeanFreePathCalcModeAlongZaxis: {
+                       DEBUGPRINT1("mode: %d in AlongZaxis\n", mode);
                        lmrcImageMeanFreePathCalcAlongZaxis(in, linfo, mode);
                        break;
                }
                default: {
+                       DEBUGPRINT1("mode: %d in default\n", mode);
                        fprintf(stderr, "Not supported mode: %d\n", mode);
-                       exit(EXIT_FAILURE);
+                       fprintf(stderr, "Thus, process as -m %d \n", MeanFreePathCalcModeAlongZaxis);
+                       lmrcImageMeanFreePathCalcAlongZaxis(in, linfo, mode);
                        break;
                }
        }
@@ -142,14 +149,18 @@ lmrcImageMeanFreePathCalcPrint(FILE* fpt, lmrcImageMeanFreePathCalcInfo* linfo,
        for(i=1; i<=linfo->N; i++) {
                fprintf(fpt, "%6d %10d %10d %10d %10d %15.6f %15.6f %15.6f %15.6f %15.6f %15.6f %15.6f %15.6f %15.6f\n", 
                        i,
-                       linfo->countWhite[i], linfo->countBlack[i],
-                       linfo->countWhiteEdge[i], linfo->countBlackEdge[i],
-                       linfo->countWhite[i]/(double)linfo->countWhite[0]*100, linfo->countBlack[i]/(double)linfo->countBlack[0]*100,
-                       linfo->countWhiteEdge[i]/(double)linfo->countWhiteEdge[0]*100, linfo->countBlackEdge[i]/(double)linfo->countBlackEdge[0]*100,
-                       linfo->countWhite[i]/(double)linfo->sumWhite*100, 
-                       linfo->countBlack[i]/(double)linfo->sumBlack*100,
-                       linfo->countWhiteEdge[i]/(double)linfo->sumWhiteEdge*100, 
-                       linfo->countBlackEdge[i]/(double)linfo->sumBlackEdge*100,
+                       linfo->countWhite[i], 
+                       linfo->countBlack[i],
+                       linfo->countWhiteEdge[i], 
+                       linfo->countBlackEdge[i],
+                       (linfo->countWhite[0]?linfo->countWhite[i]/(double)linfo->countWhite[0]*100:0), 
+                       (linfo->countBlack[0]?linfo->countBlack[i]/(double)linfo->countBlack[0]*100:0),
+                       (linfo->countWhiteEdge[0]?linfo->countWhiteEdge[i]/(double)linfo->countWhiteEdge[0]*100:0), 
+                       (linfo->countBlackEdge[0]?linfo->countBlackEdge[i]/(double)linfo->countBlackEdge[0]*100:0),
+                       (linfo->sumWhite?linfo->countWhite[i]/(double)linfo->sumWhite*100:0), 
+                       (linfo->sumBlack?linfo->countBlack[i]/(double)linfo->sumBlack*100:0),
+                       (linfo->sumWhiteEdge?linfo->countWhiteEdge[i]/(double)linfo->sumWhiteEdge*100:0), 
+                       (linfo->sumBlackEdge?linfo->countBlackEdge[i]/(double)linfo->sumBlackEdge*100:0),
                        i*linfo->Length.z);
        }
 }
@@ -336,8 +347,33 @@ lmrcImageMeanFreePathCalcAlongZaxis(mrcImage* in, lmrcImageMeanFreePathCalcInfo*
                linfo->sumBlackEdge += linfo->countBlackEdge[i];                        
        }
 
-       linfo->averageWhite         /= linfo->countWhite[0];            
-       linfo->averageBlack     /= linfo->countBlack[0];                
-       linfo->averageWhiteEdge /= linfo->countWhiteEdge[0];                    
-       linfo->averageBlackEdge /= linfo->countBlackEdge[0];                    
+       if(0<linfo->countWhite[0]) {
+               linfo->averageWhite         /= linfo->countWhite[0];            
+       } else { 
+               linfo->averageWhite         = 0;
+       }
+       if(0<linfo->countBlack[0]) {
+               linfo->averageBlack         /= linfo->countBlack[0];            
+       } else { 
+               linfo->averageBlack         = 0;
+       }
+       if(0<linfo->countWhiteEdge[0]) {
+               linfo->averageWhiteEdge     /= linfo->countWhiteEdge[0];                
+       } else { 
+               linfo->averageWhiteEdge     = 0;
+       }
+       if(0<linfo->countBlackEdge[0]) {
+               linfo->averageBlackEdge     /= linfo->countBlackEdge[0];                
+       } else { 
+               linfo->averageBlackEdge     = 0;
+       }
+
+       if(MeanFreePathCalcModeRealLength&mode) {
+               DEBUGPRINT1("mode: %d in Calc: RealLength Start\n", mode);
+               lmrcImageMultiplying2(&linfo->white, linfo->white.HeaderLength.z, linfo->white.HeaderMode);
+               lmrcImageMultiplying2(&linfo->whiteEdge, linfo->whiteEdge.HeaderLength.z, linfo->whiteEdge.HeaderMode);
+               lmrcImageMultiplying2(&linfo->black, linfo->black.HeaderLength.z, linfo->black.HeaderMode);
+               lmrcImageMultiplying2(&linfo->blackEdge, linfo->blackEdge.HeaderLength.z, linfo->blackEdge.HeaderMode);
+               DEBUGPRINT1("mode: %d in Calc: RealLength End\n", mode);
+       }
 }
index 323c2db..349fa32 100755 (executable)
@@ -11,7 +11,11 @@ help:
 
 exec:
        @echo "----- Execution Check -----"
-       ../$(OSTYPE)/$(OBJECTNAME) 
+       ../$(OSTYPE)/$(OBJECTNAME) -i data/test.bin -o data/test.mfp -m 0 -Ow data/test.white -Owe data/test.whiteEdge -Ob data/test.black -Obe data/test.blackEdge
+       ../$(OSTYPE)/$(OBJECTNAME) -i data/test.bin -o data/test.mfp16 -m 16 -Ow data/test.white16 -Owe data/test.whiteEdge16 -Ob data/test.black16 -Obe data/test.blackEdge16
        @echo "----- Calc check -----"          
 
+init:
+       pdb2mrc -i data/121p.pdb2 -o data/test.mrc -nx 32 -ny 32 -nz 32 -dx 2 -dy 2 -dz 2 -Sx -32 -Sy -32 -Sz -32 -sig 1.6 -w 1.0
+       mrcImageBinalization -i data/test.mrc -o data/test.bin -m 32
 clean:
index c232e1c..0df0071 100755 (executable)
@@ -2,11 +2,13 @@
 # FileFormat
 "-i","-i[nput]","Input","Essential","1","1","In","inFile::mrcImage","NULL"
 "-o","-o[utput]","Output","Essential","1","1","Out","outFile::mrcImage","NULL"
-"-Shape","-Shape","Output","Essential","1","1","Shape","outFile::mrcImage","NULL"
-"-r","-r[adius]","Radius[pixel]","Optional","2","1","minR","Integer","3","2","maxR","Integer","5"
-"-l","-l[ength]","Length[pixel]","Optional","2","1","minL","Integer","3","2","maxL","Integer","5"
+"-Shape","-Shape","Output","Optional","1","1","Shape","outFile::mrcImage","NULL"
+"-r","-r[adius]","Radius[pixel]","Optional","3","1","minR","Integer","3","2","maxR","Integer","5","3","delR","Integer","1"
+"-l","-l[ength]","Length[pixel]","Optional","3","1","minL","Integer","3","2","maxL","Integer","5","3","delL","Integer","1"
 "-Phi","-Phi","around z-axis[degree]","Optional","3","1","minPhi","Real","0.0","2","maxPhi","Real","359.0","3","delPhi","Real","1.0"
 "-Theta","-Theta","around x-axis[degree]","Optional","3","1","minTheta","Real","0.0","2","maxTheta","Real","359.0","3","delTheta","Real","1.0"
-"-Psi","-Psi","around x-axis[degree]","Optional","3","1","minPsi","Real","0.0","2","maxPsi","Real","359.0","3","delPsi","Real","1.0"
+"-Psi","-Psi","around x-axis[degree]","Optional","3","1","minPsi","Real","0.0","2","maxPsi","Real","0.0","3","delPsi","Real","90.0"
+"-thres","-thres[Zscore]","Zscore","Optional","1","1","thresZscore","Real","1.0"
+"-interp","-interp[olationMode]","interpMode","Optional","1","1","interpMode","Integer","0"
 "-c","-c[onfig]","ConfigurationFile","Optional","1","1","configFile","inFile","NULL"
 "-m","-m[ode]","Mode","Optional","1","1","mode","Integer","0"
index 9cff943..33ab0ff 100755 (executable)
@@ -31,12 +31,18 @@ typedef struct mrcImageShapeSearchInfo {
     long flagmaxR;
     long maxR;
     
+    long flagdelR;
+    long delR;
+    
     long flagminL;
     long minL;
     
     long flagmaxL;
     long maxL;
     
+    long flagdelL;
+    long delL;
+    
     long flagminPhi;
     float minPhi;
     
@@ -55,6 +61,21 @@ typedef struct mrcImageShapeSearchInfo {
     long flagdelTheta;
     float delTheta;
     
+    long flagminPsi;
+    float minPsi;
+    
+    long flagmaxPsi;
+    float maxPsi;
+    
+    long flagdelPsi;
+    float delPsi;
+    
+    long flagthresZscore;
+    float thresZscore;
+    
+    long flaginterpMode;
+    long interpMode;
+    
     long flagconfigFile;
     char* configFile;
     FILE* fptconfigFile;
index 0f6cd7b..5f45844 100755 (executable)
@@ -62,13 +62,16 @@ argCheck(mrcImageShapeSearchInfo* info, int argc, char* argv[])
                     SBREAK;
                 }
                 SCASE("r") {
-                    if(i+2<argc) {
+                    if(i+3<argc) {
                         info->minR = stringGetNthIntegerData(argv[i+1], 1, " ,");
                         i++;
                         info->flagminR++;
                         info->maxR = stringGetNthIntegerData(argv[i+1], 1, " ,");
                         i++;
                         info->flagmaxR++;
+                        info->delR = stringGetNthIntegerData(argv[i+1], 1, " ,");
+                        i++;
+                        info->flagdelR++;
                     } else {
                         usage(argv[0]);
                         exit(EXIT_FAILURE);
@@ -76,13 +79,16 @@ argCheck(mrcImageShapeSearchInfo* info, int argc, char* argv[])
                     SBREAK;
                 }
                 SCASE("l") {
-                    if(i+2<argc) {
+                    if(i+3<argc) {
                         info->minL = stringGetNthIntegerData(argv[i+1], 1, " ,");
                         i++;
                         info->flagminL++;
                         info->maxL = stringGetNthIntegerData(argv[i+1], 1, " ,");
                         i++;
                         info->flagmaxL++;
+                        info->delL = stringGetNthIntegerData(argv[i+1], 1, " ,");
+                        i++;
+                        info->flagdelL++;
                     } else {
                         usage(argv[0]);
                         exit(EXIT_FAILURE);
@@ -123,6 +129,45 @@ argCheck(mrcImageShapeSearchInfo* info, int argc, char* argv[])
                     }
                     SBREAK;
                 }
+                SCASE("Psi") {
+                    if(i+3<argc) {
+                        info->minPsi = stringGetNthRealData(argv[i+1], 1, " ,");
+                        i++;
+                        info->flagminPsi++;
+                        info->maxPsi = stringGetNthRealData(argv[i+1], 1, " ,");
+                        i++;
+                        info->flagmaxPsi++;
+                        info->delPsi = stringGetNthRealData(argv[i+1], 1, " ,");
+                        i++;
+                        info->flagdelPsi++;
+                    } else {
+                        usage(argv[0]);
+                        exit(EXIT_FAILURE);
+                    }
+                    SBREAK;
+                }
+                SCASE("thres") {
+                    if(i+1<argc) {
+                        info->thresZscore = stringGetNthRealData(argv[i+1], 1, " ,");
+                        i++;
+                        info->flagthresZscore++;
+                    } else {
+                        usage(argv[0]);
+                        exit(EXIT_FAILURE);
+                    }
+                    SBREAK;
+                }
+                SCASE("interp") {
+                    if(i+1<argc) {
+                        info->interpMode = stringGetNthIntegerData(argv[i+1], 1, " ,");
+                        i++;
+                        info->flaginterpMode++;
+                    } else {
+                        usage(argv[0]);
+                        exit(EXIT_FAILURE);
+                    }
+                    SBREAK;
+                }
                 SCASE("c") {
                     if(i+1<argc) {
                         info->configFile = stringGetNthWord(argv[i+1], 1, " ,");
index b911d40..217a049 100755 (executable)
@@ -17,14 +17,21 @@ init0(mrcImageShapeSearchInfo* info)
     info->fptShape = NULL;    info->flagShape = 0;
     info->minR = 3;    info->flagminR = 0;
     info->maxR = 5;    info->flagmaxR = 0;
+    info->delR = 1;    info->flagdelR = 0;
     info->minL = 3;    info->flagminL = 0;
     info->maxL = 5;    info->flagmaxL = 0;
+    info->delL = 1;    info->flagdelL = 0;
     info->minPhi = 0.0;    info->flagminPhi = 0;
     info->maxPhi = 359.0;    info->flagmaxPhi = 0;
     info->delPhi = 1.0;    info->flagdelPhi = 0;
     info->minTheta = 0.0;    info->flagminTheta = 0;
     info->maxTheta = 359.0;    info->flagmaxTheta = 0;
     info->delTheta = 1.0;    info->flagdelTheta = 0;
+    info->minPsi = 0.0;    info->flagminPsi = 0;
+    info->maxPsi = 0.0;    info->flagmaxPsi = 0;
+    info->delPsi = 90.0;    info->flagdelPsi = 0;
+    info->thresZscore = 1.0;    info->flagthresZscore = 0;
+    info->interpMode = 0;    info->flaginterpMode = 0;
     info->fptconfigFile = NULL;    info->flagconfigFile = 0;
     info->mode = 0;    info->flagmode = 0;
 }
@@ -52,11 +59,6 @@ init1(mrcImageShapeSearchInfo* info)
         info->fptOut = fileOpen(info->Out, "w");
     }
     
-    if(!info->flagShape) {
-        stringGetFromFile(s, "Shape", stdin, stdout, 0);
-        info->Shape = stringGetNthWord(s, 1, " ,\t");
-        info->flagShape++;
-    }
     if(info->flagShape) {
         info->fptShape = fileOpen(info->Shape, "w");
     }
@@ -67,12 +69,18 @@ init1(mrcImageShapeSearchInfo* info)
     if(info->flagmaxR) {
     }
     
+    if(info->flagdelR) {
+    }
+    
     if(info->flagminL) {
     }
     
     if(info->flagmaxL) {
     }
     
+    if(info->flagdelL) {
+    }
+    
     if(info->flagminPhi) {
     }
     
@@ -91,6 +99,21 @@ init1(mrcImageShapeSearchInfo* info)
     if(info->flagdelTheta) {
     }
     
+    if(info->flagminPsi) {
+    }
+    
+    if(info->flagmaxPsi) {
+    }
+    
+    if(info->flagdelPsi) {
+    }
+    
+    if(info->flagthresZscore) {
+    }
+    
+    if(info->flaginterpMode) {
+    }
+    
     if(info->flagconfigFile) {
         info->fptconfigFile = fileOpen(info->configFile, "r");
     }
index ec02b49..dcf748f 100755 (executable)
@@ -51,13 +51,17 @@ typedef struct lmrcImageShapeSearchInfo {
        float delPsi;
 
        int interpMode;
+       int thresZscore;
+
        mrcImage shape; // Template Structure 
 
        // Output
        mrcImage average; // Average for all orientations
        mrcImage SD;      // SD for all 
+       mrcImage Max;     // Max for all 
        mrcImage Zscore;  // Z-score;
-       mrcImage shapeInfo; // Shape, Orientation, ... 
+       int nShapeInfo;
+       mrcImage* shapeInfo; // Shape, Orientation, ... 
 } lmrcImageShapeSearchInfo;
 
 typedef enum lmrcImageShapeSearchMode {
@@ -67,6 +71,7 @@ typedef enum lmrcImageShapeSearchMode {
 
 extern void    lmrcImageShapeSearch(mrcImage* out, mrcImage* in, lmrcImageShapeSearchInfo* linfo, int mode);
 extern void    lmrcImageShapeSearchSylinder(mrcImage* out, mrcImage* in, lmrcImageShapeSearchInfo* linfo, int mode);
+extern void    lmrcImageShapeSearchPlane(mrcImage* out, mrcImage* in, lmrcImageShapeSearchInfo* linfo, int mode);
 extern void lmrcImageShapeSearchModePrint(FILE* fpt);
 
 int
@@ -76,6 +81,8 @@ main(int argc, char* argv[])
        lmrcImageShapeSearchInfo linfo;
        mrcImage in;
        mrcImage out;
+       char filename[1024];
+       int i;
 
        init0(&info);
     argCheck(&info, argc, argv);
@@ -84,22 +91,45 @@ main(int argc, char* argv[])
        DEBUGPRINT("Program Start\n");
        linfo.minRadius = info.minR;
        linfo.maxRadius = info.maxR;
+       linfo.delRadius = info.delR;
+       //
        linfo.minLength = info.minL;
        linfo.maxLength = info.maxL;
-
+       linfo.delLength = info.delL;
+       //      
        linfo.minPhi   = info.minPhi*RADIAN;
        linfo.maxPhi   = info.maxPhi*RADIAN;
        linfo.delPhi   = info.delPhi*RADIAN;
+       //
        linfo.minTheta = info.minTheta*RADIAN;
        linfo.maxTheta = info.maxTheta*RADIAN;
        linfo.delTheta = info.delTheta*RADIAN;
+       //
+       linfo.minPsi = info.minPsi*RADIAN;
+       linfo.maxPsi = info.maxPsi*RADIAN;
+       linfo.delPsi = info.delPsi*RADIAN;
+       //
+       linfo.thresZscore = info.thresZscore;
+       linfo.interpMode = info.interpMode;
 
        mrcFileRead(&in, info.In, "in main", 0); 
 
        lmrcImageShapeSearch(&out, &in, &linfo, info.mode);
 
        mrcFileWrite(&out, info.Out, "in main", 0);
-       mrcFileWrite(&linfo.shape, info.Shape, "in main", 0);
+       sprintf(filename, "%s.average", info.Out);      
+       mrcFileWrite(&linfo.average, filename, "in main", 0);
+       sprintf(filename, "%s.sd", info.Out);   
+       mrcFileWrite(&linfo.SD, filename, "in main", 0);
+       sprintf(filename, "%s.zscore", info.Out);       
+       mrcFileWrite(&linfo.Zscore, filename, "in main", 0);
+       sprintf(filename, "%s.max", info.Out);  
+       mrcFileWrite(&linfo.Max, filename, "in main", 0);
+       for(i=0; i<linfo.nShapeInfo; i++) {
+               sprintf(filename, "%s.shapeinfo-%02d", info.Out, i);    
+               mrcFileWrite(&linfo.shapeInfo[i], filename, "in main", 0);
+       }
+       //mrcFileWrite(&linfo.shape, info.Shape, "in main", 0);
 
        exit(EXIT_SUCCESS);
 }
@@ -148,7 +178,7 @@ lmrcImageShapeSearchSylinder(mrcImage* out, mrcImage* in, lmrcImageShapeSearchIn
        float theta, phi, psi, radius, length;
        int iPhi, iTheta, iPsi, iRadius, iLength;       
        int nPhi, nTheta, nPsi, nRadius, nLength;       
-       float max;
+       float max, ave, sum, sd, zscore;
        double* data;
        double  d, cp, sp;
        double score;
@@ -156,6 +186,8 @@ lmrcImageShapeSearchSylinder(mrcImage* out, mrcImage* in, lmrcImageShapeSearchIn
        float r, l, p;
        Matrix3D mat;
        floatVector v;
+       int i, imax;
+       int k, k0;
 
        nPhi   = (int)((linfo->maxPhi     - linfo->minPhi)  /linfo->delPhi)  +1;
        nTheta = (int)((linfo->maxTheta   - linfo->minTheta)/linfo->delTheta)+1;
@@ -169,22 +201,44 @@ lmrcImageShapeSearchSylinder(mrcImage* out, mrcImage* in, lmrcImageShapeSearchIn
        floatVectorInit(&v, 4);
        v.data[3] = 1;  
 
+       out->Header = in->Header;
+       mrcInit(out, NULL);
+       linfo->average.Header = in->Header;
+       mrcInit(&linfo->average, NULL);
+       linfo->SD.Header = in->Header;
+       mrcInit(&linfo->SD, NULL);
+       linfo->Zscore.Header = in->Header;
+       mrcInit(&linfo->Zscore, NULL);
+       linfo->Max.Header = in->Header;
+       mrcInit(&linfo->Max, NULL);
+       linfo->nShapeInfo = 5;
+       linfo->shapeInfo = (mrcImage*)memoryAllocate(sizeof(mrcImage)*linfo->nShapeInfo, "in MFPCalc");
+       for(i=0; i<linfo->nShapeInfo; i++) {
+               linfo->shapeInfo[i].Header = in->Header;
+               mrcInit(&linfo->shapeInfo[i], NULL);
+       }
+
        for(z=0; z<in->HeaderN.z; z++) {
+               DEBUGPRINT1("z: %f\n", z);
        for(y=0; y<in->HeaderN.y; y++) {
-       for(x=0; x<in->HeaderN.x; x++) {
-               for(iPhi=0; iPhi<nPhi; iPhi++) {        
+               //DEBUGPRINT1("y: %f\n", y);
+       for(x=0; x<in->HeaderN.x; x++) { // Each voxel
+               k0 = (int)(x + y*in->HeaderN.x + z*in->HeaderN.x*in->HeaderN.y); 
+               for(iPhi=0; iPhi<nPhi; iPhi++) { // Three Rotation      
                        phi = linfo->minPhi + iPhi*linfo->delPhi;
                for(iTheta=0; iTheta<nTheta; iTheta++) {        
                        theta = linfo->minTheta + iTheta*linfo->delTheta;
-               for(iPsi=0; iPsi<nPsi; iPsi++) {        
+               for(iPsi=0; iPsi<nPsi; iPsi++) {        
                        psi= linfo->minPsi+ iPhi*linfo->delPsi;
-       
-                       matrix3DRotationSetFollowingEulerAngle(mat, "ZENS", phi, theta, psi, MATRIX_3D_MODE_INITIALIZE);
+                       
+                       //DEBUGPRINT3("%f %f %f\n", phi*DEGREE, theta*DEGREE, psi*DEGREE);      
+                       matrix3DRotationSetFollowingEulerAngle(mat, 
+                               "ZENS", phi, theta, psi, MATRIX_3D_MODE_INITIALIZE); // Rotation angle set
 
-               for(iRadius=linfo->minRadius; iRadius<=linfo->maxRadius; iRadius++) {
-                       radius = linfo->minRadius + iRadius*linfo->delRadius;  
-               for(iLength=linfo->minLength; iLength<=linfo->maxLength; iLength++) {
-                       length = linfo->minLength + iLength*linfo->delLength;  
+               for(iRadius=0; iRadius<nRadius; iRadius++) {
+                       radius = linfo->minRadius + iRadius*linfo->delRadius; 
+               for(iLength=0; iLength<nLength; iLength++) {
+                       length = linfo->minLength + iLength*linfo->delLength; 
 
                        index = iPhi
                                   +iTheta *nPhi
@@ -193,22 +247,37 @@ lmrcImageShapeSearchSylinder(mrcImage* out, mrcImage* in, lmrcImageShapeSearchIn
                                   +iLength*nPhi*nTheta*nPsi*nRadius;
 
                        score = 0; 
-                       for(p=0; r<2*M_PI;  l+=linfo->delPsi) {
+                       for(p=0; p<2*M_PI;  p+=linfo->delPsi) {
                                cp = cos(p);
                                sp = sin(p);
-                       for(l=0; r<=length; l+=linfo->delLength) {
+                       for(l=0; l<=length; l+=linfo->delLength) {
                                v.data[2] = l-length/2; 
                        for(r=0; r<=radius; r+=linfo->delRadius) {
                                v.data[0] = r*cp;
                                v.data[1] = r*sp;
 
-                               matrix3DMultiplyVector(&v, mat);
-                               dstx = x + v.data[0];
-                               dsty = y + v.data[1];
-                               dstz = z + v.data[2]; 
-                               mrcPixelDataGet(in, dstx, dsty, dstz, &d, mrcPixelRePart, linfo->interpMode);
+                               //matrix3DMultiplyVector(&v, mat);
+                               srcx = mat[0][0]*v.data[0] + mat[1][0]*v.data[1] + mat[2][0]*v.data[2];
+                               srcy = mat[0][1]*v.data[0] + mat[1][1]*v.data[1] + mat[2][1]*v.data[2]; 
+                               srcz = mat[0][2]*v.data[0] + mat[1][2]*v.data[1] + mat[2][2]*v.data[2];
+
+                               dstx = x + srcx; 
+                               dsty = y + srcy;
+                               dstz = z + srcz; 
+                               //DEBUGPRINT3("dst: %f %f %f\n", dstx, dsty, dstz);
+                               //mrcPixelDataGet(in, dstx, dsty, dstz, &d, mrcPixelRePart, linfo->interpMode);
+                               if(-0.5<dstx && dstx < in->HeaderN.x-0.5
+                                &&-0.5<dsty && dsty < in->HeaderN.y-0.5
+                                &&-0.5<dstz && dstz < in->HeaderN.z-0.5) {
+                                       k = (int)(dstx+0.5) + (int)(dsty+0.5)*in->HeaderN.x + (int)(dstz+0.5)*in->HeaderN.x*in->HeaderN.y; 
+                                       d = in->ImageFloatImage[k];
+                               } else {
+                                       d = 0;
+                               }
                                score += d;
                        }
+
+                       // Edge Check
                        v.data[0] = r*cos(p);
                        v.data[1] = r*sin(p);
                        matrix3DMultiplyVector(&v, mat);
@@ -220,14 +289,31 @@ lmrcImageShapeSearchSylinder(mrcImage* out, mrcImage* in, lmrcImageShapeSearchIn
                        }
                        }
                        data[index] = score;
+#ifdef DEBUG2
+                       if(0<score) {
+                               DEBUGPRINT2("data: %d %f\n", index, score);
+                       }
+#endif
                }
                }
                }
                }
                }
-               sum = 0;        
-               for(i=0; i<nData; i++) {        
+               //DEBUGPRINT1("nData: %d\n", nData);
+               imax = 0;
+               max = data[0]; 
+               sum = data[0];  
+               for(i=1; i<nData; i++) {        
+#ifdef DEBUG2
+                       if(0<data[i]) {
+                               DEBUGPRINT2("data: %d %f\n", i, data[i]);
+                       }
+#endif
                        sum += data[i];
+                       if(max<data[i]) {
+                               imax = i;
+                               max = data[i];
+                       }
                }
                ave = sum/nData;
                sum = 0;
@@ -235,6 +321,48 @@ lmrcImageShapeSearchSylinder(mrcImage* out, mrcImage* in, lmrcImageShapeSearchIn
                        sum += SQR(data[i]-ave);
                }
                sd = sqrt(sum/nData);
+#ifdef DEBUG2
+               if(0<max) {
+               DEBUGPRINT3("%f %f %f ", x, y, z);      
+               DEBUGPRINT3("%f %f %f \n", max, ave, sd);       
+               }
+#endif
+               //mrcPixelDataSet(&linfo->average, x, y, z, ave, mrcPixelRePart);
+               linfo->average.ImageFloatImage[k0] = ave;
+
+               //mrcPixelDataSet(&linfo->SD,      x, y, z, sd, mrcPixelRePart);
+               linfo->SD.ImageFloatImage[k0] = sd;
+
+               //mrcPixelDataSet(&linfo->Max,     x, y, z, max, mrcPixelRePart);
+               linfo->Max.ImageFloatImage[k0] = max;
+
+               zscore = ((sd>0)?(max-ave)/sd:0); 
+               //mrcPixelDataSet(&linfo->Zscore,  x, y, z, zscore, mrcPixelRePart);
+               linfo->Zscore.ImageFloatImage[k0] = zscore;
+
+               d = ((zscore>linfo->thresZscore)?1:0);  
+               //mrcPixelDataSet(out,             x, y, z, d, mrcPixelRePart);
+               out->ImageFloatImage[k0] = d;
+
+               i = imax%nPhi;
+               //mrcPixelDataSet(&linfo->shapeInfo[0], x, y, z, (i*linfo->delPhi + linfo->minPhi)*DEGREE, mrcPixelRePart);
+               linfo->shapeInfo[0].ImageFloatImage[k0] =  (i*linfo->delPhi + linfo->minPhi)*DEGREE;
+
+               i = (imax%(nPhi*nTheta))/nPhi;
+               //mrcPixelDataSet(&linfo->shapeInfo[1], x, y, z, (i*linfo->delTheta + linfo->minTheta)*DEGREE, mrcPixelRePart);
+               linfo->shapeInfo[1].ImageFloatImage[k0] =  (i*linfo->delTheta + linfo->minTheta)*DEGREE;
+
+               i = (imax%(nPhi*nTheta*nPsi))/(nPhi*nTheta);
+               //mrcPixelDataSet(&linfo->shapeInfo[2], x, y, z, (i*linfo->delPsi+ linfo->minPsi)*DEGREE, mrcPixelRePart);
+               linfo->shapeInfo[2].ImageFloatImage[k0] =  (i*linfo->delPsi+ linfo->minPsi)*DEGREE;
+
+               i = (imax%(nPhi*nTheta*nPsi*nRadius))/(nPhi*nTheta*nPsi);
+               //mrcPixelDataSet(&linfo->shapeInfo[3], x, y, z, i*linfo->delRadius + linfo->minRadius, mrcPixelRePart);
+               linfo->shapeInfo[3].ImageFloatImage[k0] =  i*linfo->delRadius + linfo->minRadius;
+
+               i =  imax/(nPhi*nTheta*nPsi*nRadius);
+               mrcPixelDataSet(&linfo->shapeInfo[4], x, y, z, i*linfo->delLength + linfo->minLength, mrcPixelRePart);
+               linfo->shapeInfo[4].ImageFloatImage[k0] =  i*linfo->delLength + linfo->minLength;
        }
        }
        }
@@ -243,5 +371,6 @@ lmrcImageShapeSearchSylinder(mrcImage* out, mrcImage* in, lmrcImageShapeSearchIn
 void
 lmrcImageShapeSearchPlane(mrcImage* out, mrcImage* in, lmrcImageShapeSearchInfo* linfo, int mode)
 {
+       DEBUGPRINT("Not yet supported\n");
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index cb12288..5ec6bea
@@ -10,21 +10,29 @@ Usage: mrcImageShapeSearch
 Options:
     [-i[nput]            In                  (NULL      ).as(inFile::mrcImage    ) ] :Essential :Input
     [-o[utput]           Out                 (NULL      ).as(outFile::mrcImage   ) ] :Essential :Output
-    [-Shape              Shape               (NULL      ).as(outFile::mrcImage   ) ] :Essential :Output
+    [-Shape              Shape               (NULL      ).as(outFile::mrcImage   ) ] :Optional  :Output
     [-r[adius]           minR                (3         ).as(Integer             ) 
-                         maxR                (5         ).as(Integer             ) ] :Optional  :Radius[pixel]
+                         maxR                (5         ).as(Integer             ) 
+                         delR                (1         ).as(Integer             ) ] :Optional  :Radius[pixel]
     [-l[ength]           minL                (3         ).as(Integer             ) 
-                         maxL                (5         ).as(Integer             ) ] :Optional  :Length[pixel]
+                         maxL                (5         ).as(Integer             ) 
+                         delL                (1         ).as(Integer             ) ] :Optional  :Length[pixel]
     [-Phi                minPhi              (0.0       ).as(Real                ) 
                          maxPhi              (359.0     ).as(Real                ) 
                          delPhi              (1.0       ).as(Real                ) ] :Optional  :around z-axis[degree]
     [-Theta              minTheta            (0.0       ).as(Real                ) 
                          maxTheta            (359.0     ).as(Real                ) 
                          delTheta            (1.0       ).as(Real                ) ] :Optional  :around x-axis[degree]
+    [-Psi                minPsi              (0.0       ).as(Real                ) 
+                         maxPsi              (0.0       ).as(Real                ) 
+                         delPsi              (90.0      ).as(Real                ) ] :Optional  :around x-axis[degree]
+    [-thres[Zscore]      thresZscore         (1.0       ).as(Real                ) ] :Optional  :Zscore
+    [-interp[olationMode]interpMode          (0         ).as(Integer             ) ] :Optional  :interpMode
     [-c[onfig]           configFile          (NULL      ).as(inFile              ) ] :Optional  :ConfigurationFile
     [-m[ode]             mode                (0         ).as(Integer             ) ] :Optional  :Mode
 ----- Additional Usage -----
 0: Cylinder with radius and length
+1: Plane with radius and thickness
 </PRE>
 </BODY>
 </HTML>
index 446093b..4d500d5 100755 (executable)
@@ -9,13 +9,16 @@
         -Q 1 0 5.25x1+47+0 'Close'
         -I 1 0 1 1 0 1 -1x1+1+1.500000 ' ' 'In' 'Input' i
         -O 1 0 1 1 0 1 -1x1+1+3.000000 ' ' 'Out' 'Output' o
-        -O 1 0 1 1 0 1 -1x1+1+4.500000 ' ' 'Shape' 'Output' Shape
+        -O 1 0 1 0 0 1 -1x1+1+4.500000 ' ' 'Shape' 'Output' Shape
         -I  1 0 0 1 0 1 -1x1+1+6 ' ' '3' 'minR' Radius[pixel]
         -I  1 0 0 1 0 1 -1x1+1+7 ' ' '3' 'minL' Length[pixel]
         -I  1 0 0 1 0 1 -1x1+1+9 ' ' '0.0' 'minPhi' around z-axis[degree]
         -I  1 0 0 1 0 1 -1x1+1+10 ' ' '0.0' 'minTheta' around x-axis[degree]
-        -I 1 0 1 0 0 1 -1x1+1+12.000000 ' ' 'configFile' 'ConfigurationFile' c
-        -i 1 0 1 0 0 -1x1+1+13.500000 0 0 0 0 0 'mode' 'Mode' m
+        -I  1 0 0 1 0 1 -1x1+1+12 ' ' '0.0' 'minPsi' around x-axis[degree]
+        -f 1 0 1 0 0 -1x1+1+13.500000 0 0 1.000000 0 0 0 'thresZscore' 'Zscore' thres
+        -i 1 0 1 0 0 -1x1+1+15.000000 0 0 0 0 0 'interpMode' 'interpMode' interp
+        -I 1 0 1 0 0 1 -1x1+1+16.500000 ' ' 'configFile' 'ConfigurationFile' c
+        -i 1 0 1 0 0 -1x1+1+18.000000 0 0 0 0 0 'mode' 'Mode' m
     -E
   -E
 -E
diff --git a/src/Tools/mrcImage/mrcImageShapeSearch/src/test/Makefile b/src/Tools/mrcImage/mrcImageShapeSearch/src/test/Makefile
new file mode 100755 (executable)
index 0000000..021860d
--- /dev/null
@@ -0,0 +1,21 @@
+include ../../Config/Define.inc
+include ../../../Config/Define.inc
+include ../../../../Config/Define.inc
+include ../../../../../Config/Define.inc
+
+all: help exec
+
+help:
+       @echo "----- Help Message Check -----"
+       @../$(OSTYPE)/$(OBJECTNAME)      -h
+
+exec:
+       @echo "----- Execution Check -----"
+       ../$(OSTYPE)/$(OBJECTNAME) -i data/test-sylinder.bin -o data/test-sylinder.syl -r 3 5 1 -l 5 5 1 -Phi 0 359 30 -Theta - 0 189 30 -Psi 0 0 90 -m 0 -thres 2.5
+       @echo "----- Calc check -----"          
+
+init:
+       mrcImageModelCreate -o data/test-sylinder.mrc -nx 32 -ny 32 -nz 32 -r 3 -l 20 -m 8
+       mrcImageBinalization -i data/test-sylinder.mrc -o data/test-sylinder.bin -m 32
+
+clean:
diff --git a/src/Tools/mrcImage/mrcImageShapeSearch/src/test/data b/src/Tools/mrcImage/mrcImageShapeSearch/src/test/data
new file mode 120000 (symlink)
index 0000000..23c4fa1
--- /dev/null
@@ -0,0 +1 @@
+../../../../../..//data/mrcImageShapeSearch
\ No newline at end of file
index d093dc2..364be38 100755 (executable)
@@ -9,11 +9,14 @@ usage(char* thisProgram)
     fprintf(stderr, "Options:\n");
     fprintf(stderr, "    [-i[nput]            In                  (NULL      ).as(inFile::mrcImage    ) ] :Essential :Input\n");
     fprintf(stderr, "    [-o[utput]           Out                 (NULL      ).as(outFile::mrcImage   ) ] :Essential :Output\n");
-    fprintf(stderr, "    [-Shape              Shape               (NULL      ).as(outFile::mrcImage   ) ] :Essential :Output\n");
-    fprintf(stderr, "    [-r[adius]           minR                (3         ).as(Integer             ) \n                         maxR                (5         ).as(Integer             ) ] :Optional  :Radius[pixel]\n");
-    fprintf(stderr, "    [-l[ength]           minL                (3         ).as(Integer             ) \n                         maxL                (5         ).as(Integer             ) ] :Optional  :Length[pixel]\n");
+    fprintf(stderr, "    [-Shape              Shape               (NULL      ).as(outFile::mrcImage   ) ] :Optional  :Output\n");
+    fprintf(stderr, "    [-r[adius]           minR                (3         ).as(Integer             ) \n                         maxR                (5         ).as(Integer             ) \n                         delR                (1         ).as(Integer             ) ] :Optional  :Radius[pixel]\n");
+    fprintf(stderr, "    [-l[ength]           minL                (3         ).as(Integer             ) \n                         maxL                (5         ).as(Integer             ) \n                         delL                (1         ).as(Integer             ) ] :Optional  :Length[pixel]\n");
     fprintf(stderr, "    [-Phi                minPhi              (0.0       ).as(Real                ) \n                         maxPhi              (359.0     ).as(Real                ) \n                         delPhi              (1.0       ).as(Real                ) ] :Optional  :around z-axis[degree]\n");
     fprintf(stderr, "    [-Theta              minTheta            (0.0       ).as(Real                ) \n                         maxTheta            (359.0     ).as(Real                ) \n                         delTheta            (1.0       ).as(Real                ) ] :Optional  :around x-axis[degree]\n");
+    fprintf(stderr, "    [-Psi                minPsi              (0.0       ).as(Real                ) \n                         maxPsi              (0.0       ).as(Real                ) \n                         delPsi              (90.0      ).as(Real                ) ] :Optional  :around x-axis[degree]\n");
+    fprintf(stderr, "    [-thres[Zscore]      thresZscore         (1.0       ).as(Real                ) ] :Optional  :Zscore\n");
+    fprintf(stderr, "    [-interp[olationMode]interpMode          (0         ).as(Integer             ) ] :Optional  :interpMode\n");
     fprintf(stderr, "    [-c[onfig]           configFile          (NULL      ).as(inFile              ) ] :Optional  :ConfigurationFile\n");
     fprintf(stderr, "    [-m[ode]             mode                (0         ).as(Integer             ) ] :Optional  :Mode\n");
     additionalUsage();
index 49cd8da..c70b4bb 100755 (executable)
@@ -9,9 +9,13 @@ JPEGVERSION=9a
 #GIFVERSION=4.1.6
 GIFVERSION=5.1.1
 MESAVERSION=4.0.3
+
 #TIFFVERSION=v3.4beta037
 #TIFFVERSION=3.8.2
 TIFFVERSION=4.0.3
+TIFFNAME=tiff-$(TIFFVERSION)
+TIFFWHERE=http://download.osgeo.org/libtiff/$(TIFFNAME).tar.gz
+
 
 PNGVERSION=1.6.16
 PNGNAME=libpng-$(PNGVERSION)
@@ -20,11 +24,11 @@ PNGWHERE=http://prdownloads.sourceforge.net/libpng/libpng-1.6.16.tar.gz?download
 help:
        echo "JPEG/GIF/TIFF/MESA"
 
-check: JPEGInit GIFInit TIFFInit MESAInit PNGInit
+check: JPEGInit GIFInit TIFFInit MESAInit PNGCheck
 
 config: JPEGConfig GIFConfig MESAConfig TIFFConfig PNGConfig
 
-all: JPEG GIF MESA TIFF PNG
+all: JPEG GIF MESA TIFF PNGAll
 
 clean: JPEGClean GIFClean MESAClean TIFFClean PNGClean
 
@@ -126,9 +130,8 @@ MESACleanAll::
 #
 
 TIFFInit::
-       #ln -sf ../..//src/Graphics/tiff-$(TIFFVERSION).tar.gz .
-       curl -O http://download.osgeo.org/libtiff/tiff-$(TIFFVERSION).tar.gz 
-       gzip -dc tiff-$(TIFFVERSION).tar.gz |  tar xvf -
+       curl -O $(TIFFWHERE)
+       gzip -dc $(TIFFNAME).tar.gz |  tar xvf -
 
 TIFFConfig::
        cd tiff-$(TIFFVERSION) ; \
@@ -140,30 +143,30 @@ TIFFConfig::
        fi
 
 TIFF::
-       cd tiff-$(TIFFVERSION); \
+       cd $(TIFFNAME); \
        $(MAKE) install
 
 TIFFClean::
-       cd tiff-$(TIFFVERSION); \
+       cd $(TIFFNAME); \
        $(MAKE) -i clean 
 
 TIFFCleanAll::
-       rm -rf tiff-$(TIFFVERSION)
-       rm -rf tiff-$(TIFFVERSION).tar.gz
+       rm -rf $(TIFFNAME).tar.gz
+       rm -rf $(TIFFNAME)
 
 
 #
 # PNG
 #
 
-PNGInit::
+PNGCheck::
        curl -L $(PNGWHERE) > $(PNGNAME).tar.gz 
        gzip -dc libpng-$(PNGVERSION).tar.gz |  tar xvf -
 
 PNGConfig::
        cd $(PNGNAME) ; ./configure --prefix=${EOS_HOME}/util/$(OSTYPE) 
 
-PNG::
+PNGAll::
        cd $(PNGNAME); $(MAKE) ; $(MAKE) check; $(MAKE) install
 
 PNGClean::
@@ -174,4 +177,3 @@ PNGCleanAll::
        rm -rf $(PNGNAME).tar.gz
        rm -rf $(PNGNAME)
 
-