.. _CommandLine: ***************************** Console Applications ***************************** Included console applications =============================== dicom_dump -------------- Scan folders of DICOM files, and report the structure. Can be handy when the sorting of the images is unclear. Example of output on a MR diffusion-weighted acquisition: .. code-block:: % dicom_dump ./EP2D_DIFF_B50_400_800_TRA_P2_TRACEW_DFC_MIX_0007 StuInsUID 1.2.3.4.30000019020708423676500000016: 90 images SerInsUID 1.2.3.4.2019020714224132517098797.0.0.0: 90 images SerTim 142629.896000: 90 images SeqNam *ep_b50t: 30 images SeqNam *ep_b400t: 30 images SeqNam *ep_b800t: 30 images AcqNum 1: 90 images ImaTyp DERIVED: 90 images Echo 1: 90 images image_calculator --------------------- Calculate a new series based on existing series. Usage: image_calculator The inputs will be assigned variables a, b, c, *etc.* The expression, like 'a+b', should result in a new series of similar size as 'a'. This series will be saved in the . The calculator can do simple math and np (NumPy) operations, as long as the resulting image has a shape compatible with 'a'. DICOM series typically result in uint16 data. To perform the calculation in floating point, include option '\-\-dtype float64'. Example calculating mean of three series. The input data are converted to float64: .. code-block:: % image_calculator --serdes 'Mean T1_VIBE_FLIP' --dtype float64 \ mean '(a+b+c)/3' T1_VIBE_FLIP* Converting input... a = T1_VIBE_FLIP18_0013 (30, 192, 192) float64 b = T1_VIBE_FLIP3_0011 (30, 192, 192) float64 c = T1_VIBE_FLIP8_0012 (30, 192, 192) float64 mean = (a+b+c)/3 (30, 192, 192) float64 Example creating a mask=1 of equal size to input data. Notice the input data is only used to give matrix dimensions: .. code-block:: % image_calculator mask '1' T1_VIBE_FLIP8_0012/ a = T1_VIBE_FLIP8_0012/ (30, 192, 192) uint16 mask = 1 (30, 192, 192) uint16 Example creating a mask = np.eye(128). Notice there is no input data: .. code-block:: % image_calculator eye 'Series(np.eye(128))' eye = Series(np.eye(128)) (128, 128) float64 By default, np.eye() will produce float64 data as above. There are three methods to set the output to uint16: .. code-block:: % image_calculator eye 'Series(np.eye(128, dtype=np.uint16))' eye = Series(np.eye(128,dtype=np.uint16)) (128, 128) uint16 % image_calculator --dtype uint16 eye 'Series(np.eye(128))' eye = Series(np.eye(128)) (128, 128) float64 In the latter case, the output float64 data is converted to uint16 when writing the output. An existing DICOM object can be used as template to set DICOM attributes: .. code-block:: % image_calculator --template dicom/input --geometry dicom/input eye 'Series(np.eye(128))' eye = Series(np.eye(128)) (128, 128) float64 image_data ----------------- Convert input to output data, possible modifying the image format. The input data can be a cohort of series, study and patients. The output will be sorted in folders with appropriate names. Usage: image_data [] Some options: \-\-of : Possible output format: dicom, itk, nifti, mat (default: dicom). Can be repeated. \-\-order : How to sort input files: time, b, fa, te (default: 'none'). \-\-dtype : Specify output datatype. Otherwise keep input datatype. Dtypes: uint8, uint16, int16, int, float, float32, float64, double. \-\-template