target_link_libraries(clitkBinarizeImage clitkBinarizeImageLib clitkCommon)
set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkBinarizeImage)
-
add_executable(clitkProfileImage clitkProfileImage.cxx)
target_link_libraries(clitkProfileImage clitkProfileImageLib clitkCommon)
set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkProfileImage)
+ add_executable(clitkHistogramImage clitkHistogramImage.cxx)
+ target_link_libraries(clitkHistogramImage clitkHistogramImageLib clitkCommon)
+ set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkHistogramImage)
+
WRAP_GGO(clitkVFResample_GGO_C clitkVFResample.ggo)
add_executable(clitkVFResample clitkVFResample.cxx clitkVFResampleGenericFilter.cxx ${clitkVFResample_GGO_C})
target_link_libraries(clitkVFResample clitkCommon)
filter->SetArgsInfo(args_info);
CLITK_TRY_CATCH_EXIT(filter->Update());
+ filter->SaveAs();
return EXIT_SUCCESS;
} // This is the end, my friend
//compute bin number
typedef typename HistogramFilterType::HistogramSizeType SizeType;
SizeType binNumber(1);
- mBinSize = std::log(range);
+ if (!mArgsInfo.size_given)
+ mBinSize = std::log(range);
+ if (mBinSize == 0)
+ mBinSize = 1;
binNumber[0] = (int)(range/mBinSize);
if (binNumber[0] == 0)
binNumber[0] = 1;
}
//--------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void HistogramImageGenericFilter::SaveAs()
+{
+ // Output
+ std::string textFileName = GetOutputFilename();
+ ofstream fileOpen(textFileName.c_str(), std::ofstream::trunc);
+
+ if(!fileOpen) {
+ cerr << "Error during saving" << endl;
+ return;
+ }
+
+ int i(0);
+ fileOpen << "Value represents the number of voxels around the corresponding intensity (by default the windows size around intensity is log(range))" << endl;
+ fileOpen << "Intensity" << "\t" << "Value" << endl;
+
+ while (i<mArrayX->GetNumberOfTuples()) {
+ fileOpen << mArrayX->GetTuple(i)[0] << "\t" << mArrayY->GetTuple(i)[0] << endl;
+ ++i;
+ }
+
+ fileOpen.close();
+}
+//------------------------------------------------------------------------------
+
}//end clitk
void SetArgsInfo(const args_info_type & a);
void SetSizeBin (const double size);
+ // Save the histogram to txt file
+ void SaveAs();
+
//--------------------------------------------------------------------
// Main function called each time the filter is updated
template<class InputImageType>