@@ -284,6 +284,7 @@ def read_trajectory(
284284 raster_time : float = DEFAULT_RASTER_TIME ,
285285 read_shots : bool = False ,
286286 normalize_factor : float = KMAX ,
287+ pre_skip : int = 0 ,
287288):
288289 """Get k-space locations from gradient file.
289290
@@ -305,9 +306,13 @@ def read_trajectory(
305306 read_shots : bool, optional
306307 Whether in read shots configuration which accepts an extra
307308 point at end, by default False
308- normalize : float, optional
309+ normalize_factor : float, optional
309310 Whether to normalize the k-space locations, by default 0.5
310311 When None, normalization is not done.
312+ pre_skip: int, optional
313+ Number of samples to skip from the start of each shot,
314+ by default 0. This is useful when we want to avoid artifacts
315+ from ADC switching in UTE sequences.
311316
312317 Returns
313318 -------
@@ -424,6 +429,15 @@ def read_trajectory(
424429 if normalize_factor is not None :
425430 Kmax = img_size / 2 / fov
426431 kspace_loc = kspace_loc / Kmax * normalize_factor
432+ if pre_skip > 0 :
433+ if pre_skip >= num_samples_per_shot :
434+ raise ValueError (
435+ "skip_first_Nsamples should be less than num_adc_samples"
436+ )
437+ oversample_factor = num_adc_samples / num_samples_per_shot
438+ skip_samples = pre_skip * int (oversample_factor )
439+ kspace_loc = kspace_loc [:, skip_samples :]
440+ params ["num_adc_samples" ] = num_adc_samples - skip_samples
427441 return kspace_loc , params
428442
429443
@@ -434,6 +448,7 @@ def read_arbgrad_rawdat(
434448 squeeze : bool = True ,
435449 slice_num : int | None = None ,
436450 contrast_num : int | None = None ,
451+ pre_skip : int = 0 ,
437452 data_type : str = "ARBGRAD_VE11C" ,
438453): # pragma: no cover
439454 """Read raw data from a Siemens MRI file.
@@ -452,6 +467,10 @@ def read_arbgrad_rawdat(
452467 The slice to read, by default None. This applies for 2D data.
453468 contrast_num: int, optional
454469 The contrast to read, by default None.
470+ pre_skip : int, optional
471+ Number of samples to skip from the start of each shot,
472+ by default 0. This is useful when we want to avoid artifacts
473+ from ADC switching in UTE sequences.
455474 data_type : str, optional
456475 The type of data to read, by default 'ARBGRAD_VE11C'.
457476
@@ -500,4 +519,12 @@ def read_arbgrad_rawdat(
500519 "Phoenix" , ("sFastImaging" , "lTurboFactor" )
501520 )[0 ]
502521 hdr ["type" ] = "ARBGRAD_MP2RAGE"
522+ if pre_skip > 0 :
523+ samples_to_skip = int (hdr ["oversampling_factor" ] * pre_skip )
524+ if samples_to_skip >= hdr ["n_adc_samples" ]:
525+ raise ValueError (
526+ "Samples to skip should be less than n_samples in the data"
527+ )
528+ data = data [:, :, samples_to_skip :]
529+ hdr ["n_adc_samples" ] -= samples_to_skip
503530 return data , hdr
0 commit comments