--- /dev/null
+
+
+VV, a 4D image viewer, see : http://vv.creatis.insa-lyon.fr
+
rm -fr $(basename ${G4ABLADATA})
rm -fr $(basename ${G4LEDATA})
rm -fr $(basename ${G4REALSURFACEDATA})
-rm -fr test_libs fgate_shared_libs.tar.gz fgate_release.tar.gz
+rm -fr test_libs gate_shared_libs.tar.gz gate_release.tar.gz
echo "Copying libraries"
function get_deps {
echo "Zipping libraries"
(
cd test_libs
- tar -czvf ../fgate_shared_libs.tar.gz **
+ tar -czvf ../gate_shared_libs.tar.gz **
) || usage "can't create libraries tar"
echo "Copying binary"
cp -r "${G4PIIDATA}" .
echo "Making release"
-tar -czvf fgate_release.tar.gz \
- ${GATENAME} fgate_shared_libs.tar.gz \
+tar -czvf gate_release.tar.gz \
+ ${GATENAME} gate_shared_libs.tar.gz \
$(basename ${G4NEUTRONHPDATA}) \
$(basename ${G4LEVELGAMMADATA}) \
$(basename ${G4RADIOACTIVEDATA}) \
$(basename ${G4PIIDATA}) \
|| usage "can't create release zip"
-chmod -w fgate_release.tar.gz
+chmod -w gate_release.tar.gz
UpdateWithDimAndOutputPixelType<unsigned char,VImageDimension>();
} else if (OutputPixelType == "int") {
UpdateWithDimAndOutputPixelType<int,VImageDimension>();
+ } else if (OutputPixelType == "unsigned_int") {
+ UpdateWithDimAndOutputPixelType<unsigned int,VImageDimension>();
} else if (OutputPixelType == "double") {
UpdateWithDimAndOutputPixelType<double,VImageDimension>();
} else if (OutputPixelType == "float") {
option "upperThresholdForTrachea" - "0: Initial upper threshold for trachea" double no default="-900"
option "multiplierForTrachea" - "0: Multiplier for the region growing" double no default="5"
option "thresholdStepSizeForTrachea" - "0: Threshold step size" int no default="64"
-option "seed" - "0,1: Index of the trachea seed point (in pixel, not in mm)" int no multiple
+option "seed" - "0,1: Index of the trachea seed point (in mm NOT IN PIXELS)" float no multiple
option "doNotCheckTracheaVolume" - "0,1: If set, do not check the trachea volume" flag off
option "verboseRG" - "0,1: Verbose RegionGrowing" flag off
option "maxElongation" - "1: Maximum allowed elongation of candidate regions for the trachea" float no default="0.5"
section "Step 6 : fill holes"
option "doNotFillHoles" - "Do not fill holes if set" flag on
-option "dir" d "Directions (axes) to perform filling (defaults to 2,1,0)" int multiple no
+#option "dir" d "Directions (axes) to perform filling (defaults to 2,1,0)" int multiple no
section "Step 7 : lung separation (labelling)"
option "doNotSeparateLungs" - "Do not separate lungs if set" flag off
itkSetMacro(SeedPreProcessingThreshold, int);
itkGetConstMacro(SeedPreProcessingThreshold, int);
- void AddSeed(InternalIndexType s);
+ void AddSeedInPixels(InternalIndexType s);
+ void AddSeed(InputImagePointType s);
std::vector<InternalIndexType> & GetSeeds() { return m_Seeds; }
itkSetMacro(TracheaVolumeMustBeCheckedFlag, bool);
InputImagePixelType m_ThresholdStepSizeForTrachea;
double m_MultiplierForTrachea;
std::vector<InternalIndexType> m_Seeds;
+ std::vector<InputImagePointType> m_SeedsInMM;
int m_NumberOfSlicesToSkipBeforeSearchingSeed;
bool m_TracheaVolumeMustBeCheckedFlag;
bool m_VerboseRegionGrowingFlag;
TracheaVolumeMustBeCheckedFlagOn();
SetNumSlices(50);
SetMaxElongation(0.5);
- SetSeedPreProcessingThreshold(-400);
-
+ SetSeedPreProcessingThreshold(-400);
// Step 3 default values
SetNumberOfHistogramBins(500);
template <class ImageType>
void
clitk::ExtractLungFilter<ImageType>::
-AddSeed(InternalIndexType s)
+//AddSeed(InternalIndexType s)
+AddSeed(InputImagePointType s)
+{
+ m_SeedsInMM.push_back(s);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template <class ImageType>
+void
+clitk::ExtractLungFilter<ImageType>::
+AddSeedInPixels(InternalIndexType s)
{
m_Seeds.push_back(s);
}
// smalest one (sometimes appends with the stomach
if (initialNumberOfLabels >1) {
if (GetRemoveSmallLabelBeforeSeparationFlag()) {
- DD(GetRemoveSmallLabelBeforeSeparationFlag());
typedef itk::RelabelComponentImageFilter<MaskImageType, MaskImageType> RelabelFilterType;
typename RelabelFilterType::Pointer relabelFilter = RelabelFilterType::New();
relabelFilter->SetInput(working_mask);
it.GoToBegin();
while (!it.IsAtEnd()) {
if(it.Get() < GetUpperThresholdForTrachea() ) {
- AddSeed(it.GetIndex());
+ AddSeedInPixels(it.GetIndex());
// DD(it.GetIndex());
}
++it;
f->SetVerbose(GetVerboseRegionGrowingFlag());
for(unsigned int i=0; i<m_Seeds.size();i++) {
f->AddSeed(m_Seeds[i]);
- // DD(m_Seeds[i]);
+ //DD(m_Seeds[i]);
}
f->Update();
PrintMemory(GetVerboseMemoryFlag(), "After RG update");
// compute trachea volume
// if volume not plausible -> skip more slices and restart
+ // If initial seed, convert from mm to pixels
+ if (m_SeedsInMM.size() > 0) {
+ for(unsigned int i=0; i<m_SeedsInMM.size(); i++) {
+ InputImageIndexType index;
+ working_input->TransformPhysicalPointToIndex(m_SeedsInMM[i], index);
+ m_Seeds.push_back(index);
+ }
+ }
+
bool has_seed;
bool stop = false;
double volume = 0.0;
f->SetMaxElongation(mArgsInfo.maxElongation_arg);
f->SetSeedPreProcessingThreshold(mArgsInfo.seedPreProcessingThreshold_arg);
- typename FilterType::InputImageIndexType s;
+ typename FilterType::InputImagePointType s;
if (mArgsInfo.seed_given) {
ConvertOptionMacro(mArgsInfo.seed, s, 3, false);
- f->AddSeed(s);
+ f->AddSeed(s);
}
f->SetMinimalComponentSize(mArgsInfo.minSize_arg);
TARGET_LINK_LIBRARIES(clitkAffineTransform clitkCommon )
SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkAffineTransform)
+ WRAP_GGO(clitkElastixTransformToMatrix_GGO_C clitkElastixTransformToMatrix.ggo)
+ ADD_EXECUTABLE(clitkElastixTransformToMatrix clitkElastixTransformToMatrix.cxx ${clitkElastixTransformToMatrix_GGO_C})
+ TARGET_LINK_LIBRARIES(clitkElastixTransformToMatrix clitkCommon )
+ SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkElastixTransformToMatrix)
+
+
WRAP_GGO(clitkSetBackground_GGO_C clitkSetBackground.ggo)
ADD_EXECUTABLE(clitkSetBackground clitkSetBackground.cxx clitkSetBackgroundGenericFilter.cxx ${clitkSetBackground_GGO_C})
TARGET_LINK_LIBRARIES(clitkSetBackground clitkCommon)
//----------------------------------------
void Update();
+ template<unsigned int Dimension, class PixelType>
+ static
+ typename itk::Matrix<double, Dimension+1, Dimension+1>
+ createMatrixFromElastixFile(std::vector<std::string> & filename, bool verbose=true);
+
protected:
//----------------------------------------
template <unsigned int Dimension, class PixelType> void UpdateWithDimAndPixelType();
template <unsigned int Dimension, class PixelType> void UpdateWithDimAndVectorType();
- template<unsigned int Dimension, class PixelType>
- typename itk::Matrix<double, Dimension+1, Dimension+1>
- createMatrixFromElastixFile(std::vector<std::string> & filename);
-
- bool GetElastixValueFromTag(std::ifstream & is, std::string tag, std::string & value);
- void GetValuesFromValue(const std::string & s,
- std::vector<std::string> & values);
+ static bool GetElastixValueFromTag(std::ifstream & is, std::string tag, std::string & value);
+ static void GetValuesFromValue(const std::string & s,
+ std::vector<std::string> & values);
//----------------------------------------
// Data members
if (m_ArgsInfo.elastix_given) {
std::vector<std::string> s;
for(uint i=0; i<m_ArgsInfo.elastix_given; i++) s.push_back(m_ArgsInfo.elastix_arg[i]);
- matrix = createMatrixFromElastixFile<Dimension,PixelType>(s);
+ matrix = createMatrixFromElastixFile<Dimension,PixelType>(s, m_Verbose);
}
else
matrix.SetIdentity();
template<class args_info_type>
template<unsigned int Dimension, class PixelType>
typename itk::Matrix<double, Dimension+1, Dimension+1>
- AffineTransformGenericFilter<args_info_type>::createMatrixFromElastixFile(std::vector<std::string> & filename)
+ AffineTransformGenericFilter<args_info_type>::createMatrixFromElastixFile(std::vector<std::string> & filename, bool verbose)
{
if (Dimension != 3) {
FATAL("Only 3D yet" << std::endl);
for(uint j=0; j<filename.size(); j++) {
// Open file
- if (m_Verbose) std::cout << "Read elastix parameters in " << filename[j] << std::endl;
+ if (verbose) std::cout << "Read elastix parameters in " << filename[j] << std::endl;
std::ifstream is;
clitk::openFileForReading(is, filename[j]);
p[i+6] = atof(results[i+3].c_str()); // Translation
mat->SetParameters(p);
- if (m_Verbose) {
+ if (verbose) {
std::cout << "Rotation (deg) : " << rad2deg(p[0]) << " " << rad2deg(p[1]) << " " << rad2deg(p[2]) << std::endl;
std::cout << "Center of rot (phy) : " << p[3] << " " << p[4] << " " << p[5] << std::endl;
std::cout << "Translation (phy) : " << p[6] << " " << p[7] << " " << p[8] << std::endl;
// Compose with previous if needed
if (j!=0) {
mat->Compose(previous);
- if (m_Verbose) {
+ if (verbose) {
std::cout << "Composed rotation (deg) : " << rad2deg(mat->GetAngleX()) << " " << rad2deg(mat->GetAngleY()) << " " << rad2deg(mat->GetAngleZ()) << std::endl;
std::cout << "Composed center of rot (phy) : " << mat->GetCenter() << std::endl;
std::cout << "Compsoed translation (phy) : " << mat->GetTranslation() << std::endl;
gdcm::Attribute<0x28, 0x100> pixel_size;
pixel_size.SetFromDataSet(ds);
- if (pixel_size.GetValue() != 16)
- {
- std::cerr << "Pixel type 2 bytes ! " << std::endl;
- std::cerr << "In file " << input_files[i] << std::endl;
- exit(0);
- }
+ /* if (pixel_size.GetValue() != 16)
+ {
+ std::cerr << "Pixel type not 2 bytes ! " << std::endl;
+ std::cerr << "In file " << input_files[i] << std::endl;
+ exit(0);
+ }
+ */
#else
if (args_info.verbose_flag)
std::cout << "Not using GDCM-2.x" << std::endl;
theorigin[series_number][2] = header->GetZOrigin();
sliceLocations[series_number].push_back(theorigin[series_number][2]);
seriesFiles[series_number].push_back(input_files[i]);
- if (header->GetPixelSize() != 2) {
+ /*if (header->GetPixelSize() != 2) {
std::cerr << "Pixel type 2 bytes ! " << std::endl;
std::cerr << "In file " << input_files[i] << std::endl;
exit(0);
}
+ */
#endif
}
// itk (gdcm) include
#include "gdcmFile.h"
#if GDCM_MAJOR_VERSION == 2
- #include "gdcmReader.h"
- #include "gdcmPrinter.h"
+#include "gdcmReader.h"
+#include "gdcmPrinter.h"
+#include "gdcmDict.h"
+#include "gdcmStringFilter.h"
#endif
//--------------------------------------------------------------------
// check arg
if (args_info.inputs_num == 0) return 0;
+ // Study ID
+ #if GDCM_MAJOR_VERSION == 2
+ if (args_info.studyID_flag) {
+ std::set<std::string> l;
+ for(unsigned int i=0; i<args_info.inputs_num; i++) {
+ gdcm::Reader reader;
+ reader.SetFileName(args_info.inputs[i]);
+ std::set<gdcm::Tag> tags;
+ gdcm::Tag StudyInstanceUIDTag(0x0020, 0x000d);
+ gdcm::Tag SeriesDateTag(0x0008, 0x0021);
+ tags.insert(StudyInstanceUIDTag);
+ tags.insert(SeriesDateTag);
+ if (reader.ReadSelectedTags(tags)) {
+ gdcm::StringFilter sf;
+ sf.SetFile(reader.GetFile());
+ std::pair<std::string, std::string> p = sf.ToStringPair(StudyInstanceUIDTag);
+ std::pair<std::string, std::string> d = sf.ToStringPair(SeriesDateTag);
+ if (args_info.uniq_flag) {
+ if (l.insert(p.second).second == true) {
+ if (args_info.filename_flag)
+ std::cout << args_info.inputs[i] << " " << p.second << " " << d.second << std::endl;
+ else
+ std::cout << p.second << std::endl;
+ }
+ }
+ else {
+ if (args_info.filename_flag)
+ std::cout << args_info.inputs[i] << " " << p.second << " " << d.second << std::endl;
+ else
+ std::cout << p.second << std::endl;
+ }
+ } // tag not found
+ }
+ }
+#endif
+
// Loop files
+ if (!args_info.studyID_flag)
for(unsigned int i=0; i<args_info.inputs_num; i++) {
+ if (args_info.filename_flag) std::cout << args_info.inputs[i] << std::endl;
#if GDCM_MAJOR_VERSION == 2
gdcm::Reader reader;
reader.SetFileName(args_info.inputs[i]);
version "read and print Dicom header"
option "config" - "Config file" string no
+option "studyID" s "Only display Study UID" flag off
+option "uniq" u "Do not display if same study UID" flag off
+option "filename" f "Display filename" flag off