Skip to content

Commit d7ffe99

Browse files
committed
some more updates
1 parent 22805da commit d7ffe99

File tree

6 files changed

+73
-72
lines changed

6 files changed

+73
-72
lines changed

element.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import (
1111
"github.com/suyashkumar/dicom/pkg/tag"
1212
)
1313

14-
// ErrorUnexpectedDataType indicates that an unexpected (not allowed) data type was sent to NewValue.
15-
var ErrorUnexpectedDataType = errors.New("the type of the data was unexpected or not allowed")
14+
// ErrorUnexpectedDataType indicates that an unexpected (not allowed) int16Data type was sent to NewValue.
15+
var ErrorUnexpectedDataType = errors.New("the type of the int16Data was unexpected or not allowed")
1616

17-
// Element represents a standard DICOM data element (see the DICOM standard:
17+
// Element represents a standard DICOM int16Data element (see the DICOM standard:
1818
// https://dicom.nema.org/medical/dicom/current/output/html/part05.html#sect_7.1 ).
1919
// This Element can be serialized to JSON out of the box and pretty printed as a string via the String() method.
2020
type Element struct {
@@ -57,14 +57,14 @@ func (e *Element) String() string {
5757
e.Value.String())
5858
}
5959

60-
// Value represents a DICOM value. The underlying data that a Value stores can be determined by inspecting its
60+
// Value represents a DICOM value. The underlying int16Data that a Value stores can be determined by inspecting its
6161
// ValueType. DICOM values typically can be one of many types (ints, strings, bytes, sequences of other elements, etc),
6262
// so this Value interface attempts to represent this as canoically as possible in Golang (since generics do not exist
6363
// yet).
6464
//
6565
// Value is JSON serializable out of the box (implements json.Marshaler).
6666
//
67-
// If necessary, a Value's data can be efficiently unpacked by inspecting its underlying ValueType and either using a
67+
// If necessary, a Value's int16Data can be efficiently unpacked by inspecting its underlying ValueType and either using a
6868
// Golang type assertion or using the helper functions provided (like MustGetStrings). Because for each ValueType there
6969
// is exactly one underlying Golang type, this should be safe, efficient, and straightforward.
7070
//
@@ -79,14 +79,14 @@ func (e *Element) String() string {
7979
// // ...
8080
// }
8181
//
82-
// Unpacking the data like above is only necessary if something specific needs to be done with the underlying data.
83-
// See the Element and Dataset examples as well to see how to work with this kind of data, and common patterns for doing
82+
// Unpacking the int16Data like above is only necessary if something specific needs to be done with the underlying int16Data.
83+
// See the Element and Dataset examples as well to see how to work with this kind of int16Data, and common patterns for doing
8484
// so.
8585
type Value interface {
8686
// All types that can be a "Value" for an element will implement this empty method, similar to how protocol buffers
8787
// implement "oneof" in Go
8888
isElementValue()
89-
// ValueType returns the underlying ValueType of this Value. This can be used to unpack the underlying data in this
89+
// ValueType returns the underlying ValueType of this Value. This can be used to unpack the underlying int16Data in this
9090
// Value.
9191
ValueType() ValueType
9292
// GetValue returns the underlying value that this Value holds. What type is returned here can be determined exactly
@@ -98,7 +98,7 @@ type Value interface {
9898
Equals(Value) bool
9999
}
100100

101-
// NewValue creates a new DICOM value for the supplied data. Likely most useful
101+
// NewValue creates a new DICOM value for the supplied int16Data. Likely most useful
102102
// if creating an Element in testing or write scenarios.
103103
//
104104
// Data must be one of the following types, otherwise and error will be returned
@@ -140,7 +140,7 @@ func mustNewValue(data interface{}) Value {
140140
}
141141

142142
// NewElement creates a new DICOM Element with the supplied tag and with a value
143-
// built from the provided data. The data can be one of the types that is
143+
// built from the provided int16Data. The int16Data can be one of the types that is
144144
// acceptable to NewValue.
145145
func NewElement(t tag.Tag, data interface{}) (*Element, error) {
146146
tagInfo, err := tag.Find(t)
@@ -337,7 +337,7 @@ type SequenceItemValue struct {
337337
func (s *SequenceItemValue) isElementValue() {}
338338

339339
// ValueType returns the underlying ValueType of this Value. This can be used
340-
// to unpack the underlying data in this Value.
340+
// to unpack the underlying int16Data in this Value.
341341
func (s *SequenceItemValue) ValueType() ValueType { return SequenceItem }
342342

343343
// GetValue returns the underlying value that this Value holds. What type is
@@ -406,7 +406,7 @@ func (s *sequencesValue) Equals(target Value) bool {
406406
// PixelDataInfo is a representation of DICOM PixelData.
407407
type PixelDataInfo struct {
408408
// IntentionallySkipped indicates that reading the PixelData value was
409-
// intentionally skipped and no Value data for this tag was read.
409+
// intentionally skipped and no Value int16Data for this tag was read.
410410
// This is likely true if the dicom.SkipPixelData option was set. If true,
411411
// the rest of this PixelDataInfo will be empty.
412412
IntentionallySkipped bool `json:"intentionallySkipped"`
@@ -428,7 +428,7 @@ type PixelDataInfo struct {
428428
// should work. This will be true if the
429429
// dicom.SkipProcessingPixelDataValue flag is set with a PixelData tag.
430430
IntentionallyUnprocessed bool `json:"intentionallyUnprocessed"`
431-
// UnprocessedValueData holds the unprocessed Element value data if
431+
// UnprocessedValueData holds the unprocessed Element value int16Data if
432432
// IntentionallyUnprocessed=true.
433433
UnprocessedValueData []byte
434434
}
@@ -443,7 +443,7 @@ func (p *pixelDataValue) ValueType() ValueType { return PixelData }
443443
func (p *pixelDataValue) GetValue() interface{} { return p.PixelDataInfo }
444444
func (p *pixelDataValue) String() string {
445445
if len(p.Frames) == 0 {
446-
return "empty pixel data"
446+
return "empty pixel int16Data"
447447
}
448448
if p.IsEncapsulated {
449449
return fmt.Sprintf("encapsulated FramesLength=%d Frame[0] size=%d", len(p.Frames), len(p.Frames[0].EncapsulatedData.Data))

parse.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// work with DICOM (https://dicom.nema.org/) medical image files in Go.
33
//
44
// dicom.Parse and dicom.Write provide the core functionality to read and write
5-
// DICOM Datasets. This package provides Go data structures that represent
5+
// DICOM Datasets. This package provides Go int16Data structures that represent
66
// DICOM concepts (for example, dicom.Dataset and dicom.Element). These
77
// structures will pretty-print by default and are JSON serializable out of the
88
// box.
@@ -260,10 +260,10 @@ func SkipMetadataReadOnNewParserInit() ParseOption {
260260
}
261261
}
262262

263-
// SkipPixelData skips reading data from the PixelData tag, wherever it appears
263+
// SkipPixelData skips reading int16Data from the PixelData tag, wherever it appears
264264
// (e.g. even if within an IconSequence). A PixelDataInfo will be added to the
265265
// Dataset with the IntentionallySkipped property set to true, and no other
266-
// data. Use this option if you don't need the PixelData value to be in the
266+
// int16Data. Use this option if you don't need the PixelData value to be in the
267267
// Dataset at all, and want to save both CPU and Memory. If you need the
268268
// PixelData value in the Dataset (e.g. so it can be written out identically
269269
// later) but _don't_ want to process/parse the value, see the
@@ -281,8 +281,8 @@ func SkipPixelData() ParseOption {
281281
// a PixelData element will be added to the dataset with the
282282
// PixelDataInfo.IntentionallyUnprocessed = true, and the raw bytes of the
283283
// entire PixelData element stored in PixelDataInfo.UnprocessedValueData.
284-
//
285-
// In the future, we may be able to extend this functionality to support
284+
//
285+
// In the future, we may be able to extend this functionality to support
286286
// on-demand processing of elements elsewhere in the library.
287287
func SkipProcessingPixelDataValue() ParseOption {
288288
return func(set *parseOptSet) {

parse_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func Example_readFile() {
275275
// See also: dicom.Parse, which uses a more generic io.Reader API.
276276
dataset, _ := dicom.ParseFile("testdata/1.dcm", nil)
277277

278-
// Dataset will nicely print the DICOM dataset data out of the box.
278+
// Dataset will nicely print the DICOM dataset int16Data out of the box.
279279
fmt.Println(dataset)
280280

281281
// Dataset is also JSON serializable out of the box.

read.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ var (
3131
ErrorUnsupportedBitsAllocated = errors.New("unsupported BitsAllocated")
3232
errorUnableToParseFloat = errors.New("unable to parse float type")
3333
ErrorExpectedEvenLength = errors.New("field length is not even, in violation of DICOM spec")
34-
ErrorSignedNativePixelDataUnsupported = errors.New("the Pixel Representation tag indicates signed native pixel data is present, _and_ negative Pixel Data values were found, but this is not yet supported")
34+
ErrorSignedNativePixelDataUnsupported = errors.New("the Pixel Representation tag indicates signed native pixel int16Data is present, _and_ negative Pixel Data values were found, but this is not yet supported")
3535
)
3636

3737
// reader is responsible for mid-level dicom parsing capabilities, like
38-
// reading tags, VRs, and elements from the low-level dicomio.Reader dicom data.
38+
// reading tags, VRs, and elements from the low-level dicomio.Reader dicom int16Data.
3939
// TODO(suyashkumar): consider revisiting naming of this struct "reader" as it
4040
// interplays with the rawReader dicomio.Reader. We could consider combining
4141
// them, or embedding the dicomio.Reader struct into reader.
@@ -211,7 +211,7 @@ func (r *reader) readHeader() ([]*Element, error) {
211211
return nil, err
212212
}
213213
debug.Logf("header-group: %v", group)
214-
// Only read group 2 data
214+
// Only read group 2 int16Data
215215
if group != 0x0002 {
216216
break
217217
}
@@ -281,8 +281,8 @@ func (r *reader) readPixelData(vl uint32, d *Dataset, fc chan<- *frame.Frame) (V
281281
return val, err
282282
}
283283

284-
// Assume we're reading NativeData data since we have a defined value length as per Part 5 Sec A.4 of DICOM spec.
285-
// We need Elements that have been already parsed (rows, cols, etc) to parse frames out of NativeData Pixel data
284+
// Assume we're reading NativeData int16Data since we have a defined value length as per Part 5 Sec A.4 of DICOM spec.
285+
// We need Elements that have been already parsed (rows, cols, etc) to parse frames out of NativeData Pixel int16Data
286286
if d == nil {
287287
return nil, errors.New("the Dataset context cannot be nil in order to read Native PixelData")
288288
}
@@ -323,7 +323,7 @@ func fillBufferSingleBitAllocated(pixelData []int, d dicomio.Reader, bo binary.B
323323
debug.Logf("currentByte: %0b", currentByte)
324324

325325
// Read in the 8 bits from the current byte.
326-
// Always treat the data as LittleEndian encoded.
326+
// Always treat the int16Data as LittleEndian encoded.
327327
// This is what pydicom appears to do, and I can't get Go to properly
328328
// write out bytes literals in BigEndian, even using binary.Write
329329
// (in order to test what BigEndian might look like). We should consider

0 commit comments

Comments
 (0)