Skip to content

Commit

Permalink
BUG: add multishell and zSpace md5 test case files
Browse files Browse the repository at this point in the history
  • Loading branch information
Hui-Xie committed Mar 7, 2017
1 parent e43dc9f commit dc6a67b
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 5 deletions.
34 changes: 30 additions & 4 deletions DWIConvert/TestSuite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
set(DWITarDir ${TestData_DIR}/DWI_TestData_TARBALLS)

#make sure: tarballs are stored in /scratch/hxie1/Projects/BrainsToolsBuild/ExternalData/TestData/DWI_TestData_TARBALLS/
# 1 upload testcase file into BRAINSTools/Public/ in http://slicer.kitware.com;
# 2 download the key file(MD5);
# 3 put the MD5 file into /Volumes/scratch/hxie1/Projects/BRAINSTools/TestData/DWI_TestData_TARBALLS;
# 4 Ctest will automatically find it and download it

set(ALL_DICOM_TARBALLS
${DWITarDir}/DWIConvertGeSignaHdxBMatrixTest.tar.gz
${DWITarDir}/DWIConvertGeSignaHdxBigEndianTest.tar.gz
Expand Down Expand Up @@ -44,8 +49,9 @@ ${DWITarDir}/SiemensTrioTim2.tar.gz
${DWITarDir}/SiemensTrioTim3.tar.gz
${DWITarDir}/SiemensTrioTimBigEndian1.tar.gz
${DWITarDir}/SiemensVerio.tar.gz
${DWITarDir}/DWIConvertMultiShellFSITestSmallSize.tar.gz
${DWITarDir}/SpaceThicknessDiffDicom.tar.gz
#${DWITarDir}/DWIConvertMultiShellFSITest.tar.gz
#${DWITarDir}/SpaceThicknessDiffDicom.tar.gz
)

# accumulator for test names that actually force
Expand Down Expand Up @@ -96,7 +102,7 @@ foreach(CLP DWICompare DWISimpleCompare)
endforeach()

## Tool for comparing if BVec and BVal files are the same.
add_executable(BFileCompareTool BFileCompareTool.cpp)
add_executable(BFileCompareTool BFileCompareTool.cpp chop.cpp)
target_link_libraries(BFileCompareTool DWIConvertSupportLib BRAINSCommonLib )

#
Expand Down Expand Up @@ -130,6 +136,10 @@ set(TstOutput ${CMAKE_CURRENT_BINARY_DIR})

set(DWIBASELINE_DIR ${TestData_DIR}/DWI_TestData_OUTPUTS)

## DUMMYPROG
add_executable(chop chop.cpp)
target_link_libraries(chop BRAINSCommonLib)

#
# pretty useless test except for slight increase in coverage
# and verify the programs got built
Expand Down Expand Up @@ -447,14 +457,30 @@ AddDataDependency(DWIConvertSiemensTrio_Syngo2004A_2Test)
AddDataDependency(DWIConvertMultiShellFSITest)]]

# add a cest case supporting thicknes and zSpace of Dicom file are different on Feb 28th, 2017
#[[ExternalData_Add_Test( ${PROJECT_NAME}FetchData NAME SpaceThicknessDiffDicom
ExternalData_Add_Test( ${PROJECT_NAME}FetchData NAME SpaceThicknessDiffDicom
COMMAND ${CMAKE_COMMAND}
-D TEST_PROGRAM=$<TARGET_FILE:DWIConvert>
-D INPUTDICOMDIRECTORY=${DWIConvert_BINARY_DIR}/SpaceThicknessDiffDicom/
-D OUTPUTVOLUME=${DWIConvert_BINARY_DIR}/SpaceThicknessDiffDicom.nhdr
-D KEYVALUE_COMPARE_PROGRAM=$<TARGET_FILE:checkTagValueInHeader>
-P ${CMAKE_CURRENT_LIST_DIR}/ZspaceThicknessDiffDicom.cmake
)
AddDataDependency(SpaceThicknessDiffDicom)]]
AddDataDependency(SpaceThicknessDiffDicom)


ExternalData_Add_Test( ${PROJECT_NAME}FetchData NAME DWIConvertMultiShellFSITestSmallSize
COMMAND ${CMAKE_COMMAND}
-D TEST_PROGRAM=$<TARGET_FILE:DWIConvert>
-D INPUTVOLUME=${DWIConvert_BINARY_DIR}/DWIConvertMultiShellFSITestSmallSize.nii.gz
-D INPUTBVECTOR=${DWIConvert_BINARY_DIR}/DWIConvertMultiShellFSITestSmallSize.bvec
-D INPUTBVALUE=${DWIConvert_BINARY_DIR}/DWIConvertMultiShellFSITestSmallSize.bval
-D OUTPUTVOLUME=${DWIConvert_BINARY_DIR}/DWIConvertMultiShellFSITestSmallSize_NrrdOutput.nhdr
-D RECOVERVOLUME=${DWIConvert_BINARY_DIR}/DWIConvertMultiShellFSITestSmallSize_Recover.nii
-D RECOVERBVECTOR=${DWIConvert_BINARY_DIR}/DWIConvertMultiShellFSITestSmallSize_Recover.bvec
-D RECOVERBVALUE=${DWIConvert_BINARY_DIR}/DWIConvertMultiShellFSITestSmallSize_Recover.bval
-D TEXT_COMPARE_PROGRAM=$<TARGET_FILE:FSLTextFileCompare>
-P ${CMAKE_CURRENT_LIST_DIR}/FSLMultiShellDataTest.cmake
)
AddDataDependency(DWIConvertMultiShellFSITestSmallSize)

ExternalData_Add_Target( ${PROJECT_NAME}FetchData ) # Name of data management target
37 changes: 37 additions & 0 deletions DWIConvert/TestSuite/chop.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// Created by Hans Johnson on 3/7/17.
//

#include <itkImageFileReader.h>
#include <itkImageFileWriter.h>

#include <itkExtractImageFilter.h>

int main() {
typedef itk::Image<unsigned char,4> IMType;

typedef itk::ImageFileReader<IMType> IFR;
typedef itk::ImageFileWriter<IMType> IFW;

IFR::Pointer ifr= IFR::New();
ifr->SetFileName("/scratch/hxie1/Research/DWIConvertRefactor/RyanEckbo/dwi98.nii.gz");
ifr->Update();

IMType::Pointer img = ifr->GetOutput();

itk::ExtractImageFilter<IMType,IMType>::Pointer eif=itk::ExtractImageFilter<IMType,IMType>::New();

eif->SetInput(img);

IMType::RegionType region= img->GetLargestPossibleRegion();
IMType::RegionType::SizeType size= region.GetSize();
size[3]=10;
region.SetSize(size);
eif->SetExtractionRegion(region);
eif->Update();

IFW::Pointer ifw = IFW::New();
ifw->SetFileName("/scratch/hxie1/Research/DWIConvertRefactor/RyanEckbo/dwi10.nii.gz");
ifw->SetInput(eif->GetOutput());
ifw->Update();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1a637257ded9a5eacf7005a5bf389b2d
Original file line number Diff line number Diff line change
@@ -1 +1 @@
74e2fc277248dab7489393799cf0380f
74e2fc277248dab7489393799cf0380f

0 comments on commit dc6a67b

Please sign in to comment.